about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMark Rousskov <mark.simulacrum@gmail.com>2018-06-08 17:21:04 -0600
committerGitHub <noreply@github.com>2018-06-08 17:21:04 -0600
commitb1a6db2833f11e0147d76811b95e879f3d6d4964 (patch)
treef252df02aeae8d02fa9c63ecf47882d2699153a9
parent6abaf4e703d8c2b14141081d3e992b6f51d5dd12 (diff)
parent5c7ca77b173e170f7440ba2cb5898cfc33874681 (diff)
downloadrust-b1a6db2833f11e0147d76811b95e879f3d6d4964.tar.gz
rust-b1a6db2833f11e0147d76811b95e879f3d6d4964.zip
Rollup merge of #51396 - SimonSapin:option-nonzero-layout, r=SimonSapin
Make the size of Option<NonZero*> a documented guarantee.

Closes #49137, the tracking issue for `NonZero*`, as this was the last remaining open question.

Note that `ptr::NonNull<T>` already documents a similar guarantee.
-rw-r--r--src/libcore/num/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 26dd08b10b9..c2da9006a8a 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -39,10 +39,10 @@ macro_rules! nonzero_integers {
         $(
             /// An integer that is known not to equal zero.
             ///
-            /// This may enable some memory layout optimization such as:
+            /// This enables some memory layout optimization.
+            /// For example, `Option<NonZeroU32>` is the same size as `u32`:
             ///
             /// ```rust
-            /// # #![feature(nonzero)]
             /// use std::mem::size_of;
             /// assert_eq!(size_of::<Option<std::num::NonZeroU32>>(), size_of::<u32>());
             /// ```