@@ -35,7 +35,7 @@ impl<T: ?Sized> *const T {
3535 pub const fn is_null ( self ) -> bool {
3636 #[ inline]
3737 fn runtime_impl ( ptr : * const u8 ) -> bool {
38- ptr. addr ( ) == 0
38+ ptr. addr_without_provenance ( ) == 0
3939 }
4040
4141 #[ inline]
@@ -203,7 +203,7 @@ impl<T: ?Sized> *const T {
203203 #[ must_use]
204204 #[ inline( always) ]
205205 #[ unstable( feature = "strict_provenance" , issue = "95228" ) ]
206- pub fn addr ( self ) -> usize {
206+ pub fn addr_without_provenance ( self ) -> usize {
207207 // FIXME(strict_provenance_magic): I am magic and should be a compiler intrinsic.
208208 // SAFETY: Pointer-to-integer transmutes are valid (if you are okay with losing the
209209 // provenance).
@@ -223,7 +223,7 @@ impl<T: ?Sized> *const T {
223223 /// Provenance][super#strict-provenance] rules. Supporting
224224 /// [`from_exposed_addr`][] complicates specification and reasoning and may not be supported by
225225 /// tools that help you to stay conformant with the Rust memory model, so it is recommended to
226- /// use [`addr `][pointer::addr ] wherever possible.
226+ /// use [`addr_without_provenance `][pointer::addr_without_provenance ] wherever possible.
227227 ///
228228 /// On most platforms this will produce a value with the same bytes as the original pointer,
229229 /// because all the bytes are dedicated to describing the address. Platforms which need to store
@@ -264,7 +264,7 @@ impl<T: ?Sized> *const T {
264264 // In the mean-time, this operation is defined to be "as if" it was
265265 // a wrapping_offset, so we can emulate it as such. This should properly
266266 // restore pointer provenance even under today's compiler.
267- let self_addr = self . addr ( ) as isize ;
267+ let self_addr = self . addr_without_provenance ( ) as isize ;
268268 let dest_addr = addr as isize ;
269269 let offset = dest_addr. wrapping_sub ( self_addr) ;
270270
@@ -282,7 +282,7 @@ impl<T: ?Sized> *const T {
282282 #[ inline]
283283 #[ unstable( feature = "strict_provenance" , issue = "95228" ) ]
284284 pub fn map_addr ( self , f : impl FnOnce ( usize ) -> usize ) -> Self {
285- self . with_addr ( f ( self . addr ( ) ) )
285+ self . with_addr ( f ( self . addr_without_provenance ( ) ) )
286286 }
287287
288288 /// Decompose a (possibly wide) pointer into its data pointer and metadata components.
@@ -592,7 +592,7 @@ impl<T: ?Sized> *const T {
592592 /// let tagged_ptr = ptr.map_addr(|a| a | 0b10);
593593 ///
594594 /// // Get the "tag" back
595- /// let tag = tagged_ptr.addr () & tag_mask;
595+ /// let tag = tagged_ptr.addr_without_provenance () & tag_mask;
596596 /// assert_eq!(tag, 0b10);
597597 ///
598598 /// // Note that `tagged_ptr` is unaligned, it's UB to read from it.
@@ -664,7 +664,7 @@ impl<T: ?Sized> *const T {
664664 /// runtime and may be exploited by optimizations. If you wish to compute the difference between
665665 /// pointers that are not guaranteed to be from the same allocation, use `(self as isize -
666666 /// origin as isize) / mem::size_of::<T>()`.
667- // FIXME: recommend `addr ()` instead of `as usize` once that is stable.
667+ // FIXME: recommend `addr_without_provenance ()` instead of `as usize` once that is stable.
668668 ///
669669 /// [`add`]: #method.add
670670 /// [allocated object]: crate::ptr#allocated-object
@@ -1611,7 +1611,7 @@ impl<T: ?Sized> *const T {
16111611
16121612 #[ inline]
16131613 fn runtime_impl ( ptr : * const ( ) , align : usize ) -> bool {
1614- ptr. addr ( ) & ( align - 1 ) == 0
1614+ ptr. addr_without_provenance ( ) & ( align - 1 ) == 0
16151615 }
16161616
16171617 #[ inline]
0 commit comments