@@ -937,6 +937,7 @@ impl<T: ?Sized> *mut T {
937
937
///
938
938
/// // This would be incorrect, as the pointers are not correctly ordered:
939
939
/// // ptr1.offset_from(ptr2)
940
+ /// ```
940
941
#[ stable( feature = "ptr_sub_ptr" , since = "1.87.0" ) ]
941
942
#[ rustc_const_stable( feature = "const_ptr_sub_ptr" , since = "1.87.0" ) ]
942
943
#[ inline]
@@ -945,7 +946,7 @@ impl<T: ?Sized> *mut T {
945
946
where
946
947
T : Sized ,
947
948
{
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 `.
949
950
unsafe { ( self as * const T ) . offset_from_unsigned ( origin) }
950
951
}
951
952
@@ -954,8 +955,8 @@ impl<T: ?Sized> *mut T {
954
955
/// units of **bytes**.
955
956
///
956
957
/// 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.
959
960
///
960
961
/// For non-`Sized` pointees this operation considers only the data pointers,
961
962
/// ignoring the metadata.
@@ -964,7 +965,7 @@ impl<T: ?Sized> *mut T {
964
965
#[ inline]
965
966
#[ cfg_attr( miri, track_caller) ] // even without panics, this helps for Miri backtraces
966
967
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 `.
968
969
unsafe { ( self as * const T ) . byte_offset_from_unsigned ( origin) }
969
970
}
970
971
0 commit comments