Skip to content

Commit b1a6db2

Browse files
Rollup merge of rust-lang#51396 - SimonSapin:option-nonzero-layout, r=SimonSapin
Make the size of Option<NonZero*> a documented guarantee. Closes rust-lang#49137, the tracking issue for `NonZero*`, as this was the last remaining open question. Note that `ptr::NonNull<T>` already documents a similar guarantee.
2 parents 6abaf4e + 5c7ca77 commit b1a6db2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/num/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ macro_rules! nonzero_integers {
3939
$(
4040
/// An integer that is known not to equal zero.
4141
///
42-
/// This may enable some memory layout optimization such as:
42+
/// This enables some memory layout optimization.
43+
/// For example, `Option<NonZeroU32>` is the same size as `u32`:
4344
///
4445
/// ```rust
45-
/// # #![feature(nonzero)]
4646
/// use std::mem::size_of;
4747
/// assert_eq!(size_of::<Option<std::num::NonZeroU32>>(), size_of::<u32>());
4848
/// ```

0 commit comments

Comments
 (0)