Skip to content

Commit b142720

Browse files
authored
Document NonZeroXxx layout guarantees
Document that `NonZeroXxx` has the same layout and bit validity as `Xxx` with the exception of `0`.
1 parent 10dccdc commit b142720

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

library/core/src/num/nonzero.rs

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ macro_rules! nonzero_integers {
3434
/// use std::mem::size_of;
3535
#[doc = concat!("assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", stringify!($Int), ">());")]
3636
/// ```
37+
///
38+
/// # Layout
39+
///
40+
#[doc = concat!("`", stringify!($Ty), "` is guaranteed to have the same layout and bit validity as `", stringify!($Int), "`"]
41+
/// with the exception that `0` is not a valid instance.
3742
#[$stability]
3843
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3944
#[repr(transparent)]

0 commit comments

Comments
 (0)