@@ -937,6 +937,7 @@ impl<T: ?Sized> *mut T {
937937 ///
938938 /// // This would be incorrect, as the pointers are not correctly ordered:
939939 /// // ptr1.offset_from(ptr2)
940+ /// ```
940941 #[ stable( feature = "ptr_sub_ptr" , since = "1.87.0" ) ]
941942 #[ rustc_const_stable( feature = "const_ptr_sub_ptr" , since = "1.87.0" ) ]
942943 #[ inline]
@@ -945,7 +946,7 @@ impl<T: ?Sized> *mut T {
945946 where
946947 T : Sized ,
947948 {
948- // SAFETY: the caller must uphold the safety contract for `sub_ptr `.
949+ // SAFETY: the caller must uphold the safety contract for `offset_from_unsigned `.
949950 unsafe { ( self as * const T ) . offset_from_unsigned ( origin) }
950951 }
951952
@@ -954,8 +955,8 @@ impl<T: ?Sized> *mut T {
954955 /// units of **bytes**.
955956 ///
956957 /// This is purely a convenience for casting to a `u8` pointer and
957- /// using [`sub_ptr `][pointer::offset_from_unsigned] on it. See that method for
958- /// documentation and safety requirements.
958+ /// using [`offset_from_unsigned `][pointer::offset_from_unsigned] on it.
959+ /// See that method for documentation and safety requirements.
959960 ///
960961 /// For non-`Sized` pointees this operation considers only the data pointers,
961962 /// ignoring the metadata.
@@ -964,7 +965,7 @@ impl<T: ?Sized> *mut T {
964965 #[ inline]
965966 #[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
966967 pub const unsafe fn byte_offset_from_unsigned < U : ?Sized > ( self , origin : * mut U ) -> usize {
967- // SAFETY: the caller must uphold the safety contract for `byte_sub_ptr `.
968+ // SAFETY: the caller must uphold the safety contract for `byte_offset_from_unsigned `.
968969 unsafe { ( self as * const T ) . byte_offset_from_unsigned ( origin) }
969970 }
970971
0 commit comments