rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}`
@ 2025-08-01 16:17 ` Miguel Ojeda
  2025-08-01 17:55   ` Alice Ryhl
                     ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Miguel Ojeda @ 2025-08-01 16:17 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	Alexandre Courbot, rust-for-linux, linux-kernel, patches

Rust 1.80.0 added:

    align_of
    align_of_val
    size_of
    size_of_val

from `core::mem` to the prelude [1].

For similar reasons, and to minimize potential confusion when code may
work in later versions but not in our current minimum, add it to our
prelude too.

Link: https://github.com/rust-lang/rust/pull/123168 [1]
Link: https://lore.kernel.org/rust-for-linux/CANiq72kOLYR2A95o0ji2mDmEqOKh9e9_60zZKmgF=vZmsW6DRg@mail.gmail.com/ [2]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
 rust/kernel/prelude.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
index 25fe97aafd02..198d09a31449 100644
--- a/rust/kernel/prelude.rs
+++ b/rust/kernel/prelude.rs
@@ -12,7 +12,10 @@
 //! ```
 
 #[doc(no_inline)]
-pub use core::pin::Pin;
+pub use core::{
+    mem::{align_of, align_of_val, size_of, size_of_val},
+    pin::Pin,
+};
 
 pub use ::ffi::{
     c_char, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint, c_ulong, c_ulonglong,

base-commit: dff64b072708ffef23c117fa1ee1ea59eb417807
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}`
  2025-08-01 16:17 ` [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}` Miguel Ojeda
@ 2025-08-01 17:55   ` Alice Ryhl
  2025-08-01 18:22   ` Daniel Almeida
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Alice Ryhl @ 2025-08-01 17:55 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
	Alexandre Courbot, rust-for-linux, linux-kernel, patches

On Fri, Aug 1, 2025 at 6:18 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Rust 1.80.0 added:
>
>     align_of
>     align_of_val
>     size_of
>     size_of_val
>
> from `core::mem` to the prelude [1].
>
> For similar reasons, and to minimize potential confusion when code may
> work in later versions but not in our current minimum, add it to our
> prelude too.
>
> Link: https://github.com/rust-lang/rust/pull/123168 [1]
> Link: https://lore.kernel.org/rust-for-linux/CANiq72kOLYR2A95o0ji2mDmEqOKh9e9_60zZKmgF=vZmsW6DRg@mail.gmail.com/ [2]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
>  rust/kernel/prelude.rs | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
> index 25fe97aafd02..198d09a31449 100644
> --- a/rust/kernel/prelude.rs
> +++ b/rust/kernel/prelude.rs
> @@ -12,7 +12,10 @@
>  //! ```
>
>  #[doc(no_inline)]
> -pub use core::pin::Pin;
> +pub use core::{
> +    mem::{align_of, align_of_val, size_of, size_of_val},
> +    pin::Pin,
> +};
>
>  pub use ::ffi::{
>      c_char, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint, c_ulong, c_ulonglong,
>
> base-commit: dff64b072708ffef23c117fa1ee1ea59eb417807
> --
> 2.50.1
>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}`
  2025-08-01 16:17 ` [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}` Miguel Ojeda
  2025-08-01 17:55   ` Alice Ryhl
@ 2025-08-01 18:22   ` Daniel Almeida
  2025-08-01 19:09   ` Benno Lossin
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Daniel Almeida @ 2025-08-01 18:22 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Alexandre Courbot, rust-for-linux, linux-kernel,
	patches



> On 1 Aug 2025, at 13:17, Miguel Ojeda <ojeda@kernel.org> wrote:
> 
> Rust 1.80.0 added:
> 
>    align_of
>    align_of_val
>    size_of
>    size_of_val
> 
> from `core::mem` to the prelude [1].
> 
> For similar reasons, and to minimize potential confusion when code may
> work in later versions but not in our current minimum, add it to our
> prelude too.
> 
> Link: https://github.com/rust-lang/rust/pull/123168 [1]
> Link: https://lore.kernel.org/rust-for-linux/CANiq72kOLYR2A95o0ji2mDmEqOKh9e9_60zZKmgF=vZmsW6DRg@mail.gmail.com/ [2]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> rust/kernel/prelude.rs | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
> index 25fe97aafd02..198d09a31449 100644
> --- a/rust/kernel/prelude.rs
> +++ b/rust/kernel/prelude.rs
> @@ -12,7 +12,10 @@
> //! ```
> 
> #[doc(no_inline)]
> -pub use core::pin::Pin;
> +pub use core::{
> +    mem::{align_of, align_of_val, size_of, size_of_val},
> +    pin::Pin,
> +};
> 
> pub use ::ffi::{
>     c_char, c_int, c_long, c_longlong, c_schar, c_short, c_uchar, c_uint, c_ulong, c_ulonglong,
> 
> base-commit: dff64b072708ffef23c117fa1ee1ea59eb417807
> -- 
> 2.50.1
> 
> 

Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}`
  2025-08-01 16:17 ` [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}` Miguel Ojeda
  2025-08-01 17:55   ` Alice Ryhl
  2025-08-01 18:22   ` Daniel Almeida
@ 2025-08-01 19:09   ` Benno Lossin
  2025-08-04  2:15   ` Alexandre Courbot
  2025-08-05  7:55   ` Andreas Hindborg
  4 siblings, 0 replies; 6+ messages in thread
From: Benno Lossin @ 2025-08-01 19:09 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Andreas Hindborg,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Alexandre Courbot,
	rust-for-linux, linux-kernel, patches

On Fri Aug 1, 2025 at 6:17 PM CEST, Miguel Ojeda wrote:
> Rust 1.80.0 added:
>
>     align_of
>     align_of_val
>     size_of
>     size_of_val
>
> from `core::mem` to the prelude [1].
>
> For similar reasons, and to minimize potential confusion when code may
> work in later versions but not in our current minimum, add it to our
> prelude too.
>
> Link: https://github.com/rust-lang/rust/pull/123168 [1]
> Link: https://lore.kernel.org/rust-for-linux/CANiq72kOLYR2A95o0ji2mDmEqOKh9e9_60zZKmgF=vZmsW6DRg@mail.gmail.com/ [2]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Reviewed-by: Benno Lossin <lossin@kernel.org>

---
Cheers,
Benno

> ---
>  rust/kernel/prelude.rs | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}`
  2025-08-01 16:17 ` [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}` Miguel Ojeda
                     ` (2 preceding siblings ...)
  2025-08-01 19:09   ` Benno Lossin
@ 2025-08-04  2:15   ` Alexandre Courbot
  2025-08-05  7:55   ` Andreas Hindborg
  4 siblings, 0 replies; 6+ messages in thread
From: Alexandre Courbot @ 2025-08-04  2:15 UTC (permalink / raw)
  To: Miguel Ojeda, Alex Gaynor
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
	rust-for-linux, linux-kernel, patches

On Sat Aug 2, 2025 at 1:17 AM JST, Miguel Ojeda wrote:
> Rust 1.80.0 added:
>
>     align_of
>     align_of_val
>     size_of
>     size_of_val
>
> from `core::mem` to the prelude [1].
>
> For similar reasons, and to minimize potential confusion when code may
> work in later versions but not in our current minimum, add it to our
> prelude too.
>
> Link: https://github.com/rust-lang/rust/pull/123168 [1]
> Link: https://lore.kernel.org/rust-for-linux/CANiq72kOLYR2A95o0ji2mDmEqOKh9e9_60zZKmgF=vZmsW6DRg@mail.gmail.com/ [2]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Nice to have these more readily accessible!

Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}`
  2025-08-01 16:17 ` [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}` Miguel Ojeda
                     ` (3 preceding siblings ...)
  2025-08-04  2:15   ` Alexandre Courbot
@ 2025-08-05  7:55   ` Andreas Hindborg
  4 siblings, 0 replies; 6+ messages in thread
From: Andreas Hindborg @ 2025-08-05  7:55 UTC (permalink / raw)
  To: Miguel Ojeda, Miguel Ojeda, Alex Gaynor
  Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
	Alice Ryhl, Trevor Gross, Danilo Krummrich, Alexandre Courbot,
	rust-for-linux, linux-kernel, patches

"Miguel Ojeda" <ojeda@kernel.org> writes:

> Rust 1.80.0 added:
>
>     align_of
>     align_of_val
>     size_of
>     size_of_val
>
> from `core::mem` to the prelude [1].
>
> For similar reasons, and to minimize potential confusion when code may
> work in later versions but not in our current minimum, add it to our
> prelude too.
>
> Link: https://github.com/rust-lang/rust/pull/123168 [1]
> Link: https://lore.kernel.org/rust-for-linux/CANiq72kOLYR2A95o0ji2mDmEqOKh9e9_60zZKmgF=vZmsW6DRg@mail.gmail.com/ [2]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

Reviewed-by: Andreas Hindborg <a.hindborg@kernel.org>


Best regards,
Andreas Hindborg



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-05  7:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <dVcviDiszZYohRRvhNw_T69gnpyGEpsQrNQF_bJO3r_YMAc4r01Sa8aOAYaXDcb-Ci6DpazHmWGSpI9fFm6p_Q==@protonmail.internalid>
2025-08-01 16:17 ` [PATCH] rust: prelude: re-export `core::mem::{align,size}_of{,_val}` Miguel Ojeda
2025-08-01 17:55   ` Alice Ryhl
2025-08-01 18:22   ` Daniel Almeida
2025-08-01 19:09   ` Benno Lossin
2025-08-04  2:15   ` Alexandre Courbot
2025-08-05  7:55   ` Andreas Hindborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).