]> git.lizzy.rs Git - rust.git/blobdiff - library/core/src/ptr/const_ptr.rs
Rollup merge of #103564 - RalfJung:miri-unused, r=thomcc
[rust.git] / library / core / src / ptr / const_ptr.rs
index d898108be580f3864499f9fdf2726fdca88a49e3..5a083227bb0efda119a32a6458b3d129affaace6 100644 (file)
@@ -694,7 +694,7 @@ pub fn mask(self, mask: usize) -> *const T {
     /// units of T: the distance in bytes is divided by `mem::size_of::<T>()`.
     ///
     /// This computes the same value that [`offset_from`](#method.offset_from)
-    /// would compute, but with the added precondition that that the offset is
+    /// would compute, but with the added precondition that the offset is
     /// guaranteed to be non-negative.  This method is equivalent to
     /// `usize::from(self.offset_from(origin)).unwrap_unchecked()`,
     /// but it provides slightly more information to the optimizer, which can
@@ -761,7 +761,10 @@ pub fn mask(self, mask: usize) -> *const T {
         // SAFETY: The comparison has no side-effects, and the intrinsic
         // does this check internally in the CTFE implementation.
         unsafe {
-            assert_unsafe_precondition!([T](this: *const T, origin: *const T) => this >= origin)
+            assert_unsafe_precondition!(
+                "ptr::sub_ptr requires `this >= origin`",
+                [T](this: *const T, origin: *const T) => this >= origin
+            )
         };
 
         let pointee_size = mem::size_of::<T>();
@@ -802,7 +805,7 @@ pub const fn guaranteed_eq(self, other: *const T) -> Option<bool>
 
     /// Returns whether two pointers are guaranteed to be inequal.
     ///
-    /// At runtime this function behaves like `Some(self == other)`.
+    /// At runtime this function behaves like `Some(self != other)`.
     /// However, in some contexts (e.g., compile-time evaluation),
     /// it is not always possible to determine inequality of two pointers, so this function may
     /// spuriously return `None` for pointers that later actually turn out to have its inequality known.