rust/kernel/prelude.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
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
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>
> 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>
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(-)
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>
"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
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> Applied to `rust-next` -- thanks everyone! Cheers, Miguel
© 2016 - 2025 Red Hat, Inc.