]> git.lizzy.rs Git - rust.git/blobdiff - library/core/src/ptr/alignment.rs
Rollup merge of #103616 - rust-lang:notriddle/moz-box-sizing, r=GuillaumeGomez
[rust.git] / library / core / src / ptr / alignment.rs
index 56c5e6cb72462b9d586ba741228ae779a2d248a7..1390e09dd96aec4c74b785ab6b26a8a0353812ac 100644 (file)
@@ -76,14 +76,19 @@ pub const fn new(align: usize) -> Option<Self> {
     #[inline]
     pub const unsafe fn new_unchecked(align: usize) -> Self {
         // SAFETY: Precondition passed to the caller.
-        unsafe { assert_unsafe_precondition!((align: usize) => align.is_power_of_two()) };
+        unsafe {
+            assert_unsafe_precondition!(
+               "Alignment::new_unchecked requires a power of two",
+                (align: usize) => align.is_power_of_two()
+            )
+        };
 
         // SAFETY: By precondition, this must be a power of two, and
         // our variants encompass all possible powers of two.
         unsafe { mem::transmute::<usize, Alignment>(align) }
     }
 
-    /// Returns the alignment as a [`NonZeroUsize`]
+    /// Returns the alignment as a [`usize`]
     #[unstable(feature = "ptr_alignment_type", issue = "102070")]
     #[rustc_const_unstable(feature = "ptr_alignment_type", issue = "102070")]
     #[inline]
@@ -91,7 +96,7 @@ pub const fn as_usize(self) -> usize {
         self.0 as usize
     }
 
-    /// Returns the alignment as a [`usize`]
+    /// Returns the alignment as a [`NonZeroUsize`]
     #[unstable(feature = "ptr_alignment_type", issue = "102070")]
     #[inline]
     pub const fn as_nonzero(self) -> NonZeroUsize {