Skip to contentSkip to conversation

rust: prelude: re-export `core::mem::{align,size}_of{,_val}`

PATCH Applied Miguel Ojeda 7 participants 7 messages Aug 1, 2025 – Sep 7, 2025 Rust

lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 rust: prelude: re-export `core::mem::{align,size}_of{,_val}`

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.

---
 rust/kernel/prelude.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
rust/kernel/prelude.rs +4 -1
index 25fe97aafd02..198d09a31449 100644
@@ -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

Signature · 1 line
2.50.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 38 lines · Miguel Ojeda

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.

---
 rust/kernel/prelude.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
rust/kernel/prelude.rs +4 -1
index 25fe97aafd02..198d09a31449 100644
@@ -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,
Quoted 4 lines

base-commit: dff64b072708ffef23c117fa1ee1ea59eb417807 --
2.50.1

reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Miguel Ojeda
Quoted 41 lines · Miguel Ojeda

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.

---
rust/kernel/prelude.rs | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
rust/kernel/prelude.rs +4 -1
index 25fe97aafd02..198d09a31449 100644
@@ -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,
Quoted 5 lines

base-commit: dff64b072708ffef23c117fa1ee1ea59eb417807

Signature · 1 line
2.50.1
reviewer Reviewed-by on v1 1/1
#3 lore raw
In reply to Miguel Ojeda
Quoted 9 lines · Miguel Ojeda

Rust 1.80.0 added:

align_of
align_of_val
size_of
size_of_val

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

Quoted 7 lines

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.

---
Cheers,
Benno

Quoted 3 lines
---
 rust/kernel/prelude.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
reviewer Reviewed-by on v1 1/1
#4 lore raw
In reply to Miguel Ojeda
Quoted 9 lines · Miguel Ojeda

Rust 1.80.0 added:

align_of
align_of_val
size_of
size_of_val

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

Quoted 7 lines

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.

Nice to have these more readily accessible!

reviewer Reviewed-by on v1 1/1
#5 lore raw
In reply to Miguel Ojeda
Quoted 9 lines · Miguel Ojeda

Rust 1.80.0 added:

align_of
align_of_val
size_of
size_of_val

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

Quoted 7 lines

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.

Best regards,
Andreas Hindborg

Applied
#6 lore raw
In reply to Miguel Ojeda
Quoted 10 lines · Miguel Ojeda

Rust 1.80.0 added:

align_of
align_of_val
size_of
size_of_val

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

Quoted 7 lines

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.

Applied to rust-next -- thanks everyone!

Cheers,
Miguel