Skip to content

Commit

Permalink
Document NonZeroXxx layout guarantees
Browse files Browse the repository at this point in the history
Document that `NonZeroXxx` has the same layout and bit validity as `Xxx` with the exception of `0`.
  • Loading branch information
joshlf authored Mar 9, 2022
1 parent 10dccdc commit b142720
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions library/core/src/num/nonzero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ macro_rules! nonzero_integers {
/// use std::mem::size_of;
#[doc = concat!("assert_eq!(size_of::<Option<core::num::", stringify!($Ty), ">>(), size_of::<", stringify!($Int), ">());")]
/// ```
///
/// # Layout
///
#[doc = concat!("`", stringify!($Ty), "` is guaranteed to have the same layout and bit validity as `", stringify!($Int), "`"]
/// with the exception that `0` is not a valid instance.
#[$stability]
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(transparent)]
Expand Down

0 comments on commit b142720

Please sign in to comment.