diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index 56f6a561f4bb9..1dc6a9f9f105e 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -567,9 +567,8 @@ impl *const T { /// needed for `const`-compatibility: the distance between pointers into *different* allocated /// objects is not known at compile-time. However, the requirement also exists at /// runtime and may be exploited by optimizations. If you wish to compute the difference between - /// pointers that are not guaranteed to be from the same allocation, use `(self as isize - - /// origin as isize) / size_of::()`. - // FIXME: recommend `addr()` instead of `as usize` once that is stable. + /// pointers that are not guaranteed to be from the same allocation, use + /// `(self.addr() as isize - origin.addr() as isize) / size_of::()`. /// /// [`add`]: #method.add /// [allocation]: crate::ptr#allocation diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index b333f8217b2c0..c7585fde42180 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -748,9 +748,8 @@ impl *mut T { /// needed for `const`-compatibility: the distance between pointers into *different* allocated /// objects is not known at compile-time. However, the requirement also exists at /// runtime and may be exploited by optimizations. If you wish to compute the difference between - /// pointers that are not guaranteed to be from the same allocation, use `(self as isize - - /// origin as isize) / size_of::()`. - // FIXME: recommend `addr()` instead of `as usize` once that is stable. + /// pointers that are not guaranteed to be from the same allocation, use + /// `(self.addr() as isize - origin.addr() as isize) / size_of::()`. /// /// [`add`]: #method.add /// [allocation]: crate::ptr#allocation diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index 6ec34206a4248..d2c2a88bbd08b 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -736,9 +736,8 @@ impl NonNull { /// needed for `const`-compatibility: the distance between pointers into *different* allocated /// objects is not known at compile-time. However, the requirement also exists at /// runtime and may be exploited by optimizations. If you wish to compute the difference between - /// pointers that are not guaranteed to be from the same allocation, use `(self as isize - - /// origin as isize) / size_of::()`. - // FIXME: recommend `addr()` instead of `as usize` once that is stable. + /// pointers that are not guaranteed to be from the same allocation, use + /// `(self.addr() as isize - origin.addr() as isize) / size_of::()`. /// /// [`add`]: #method.add /// [allocation]: crate::ptr#allocation