@@ -240,8 +240,8 @@ impl<T: ?Sized> *const T {
240240 /// different allocated object. Note that in Rust,
241241 /// every (stack-allocated) variable is considered a separate allocated object.
242242 ///
243- /// In other words, `x.wrapping_offset(y.wrapping_offset_from(x))` is
244- /// *not* the same as `y`, and dereferencing it is undefined behavior
243+ /// In other words, `x.wrapping_offset((y as usize).wrapping_sub(x as usize) / size_of::<T>())`
244+ /// is *not* the same as `y`, and dereferencing it is undefined behavior
245245 /// unless `x` and `y` point into the same allocated object.
246246 ///
247247 /// Compared to [`offset`], this method basically delays the requirement of staying
@@ -292,7 +292,6 @@ impl<T: ?Sized> *const T {
292292 /// This function is the inverse of [`offset`].
293293 ///
294294 /// [`offset`]: #method.offset
295- /// [`wrapping_offset_from`]: #method.wrapping_offset_from
296295 ///
297296 /// # Safety
298297 ///
@@ -326,10 +325,6 @@ impl<T: ?Sized> *const T {
326325 /// Extension. As such, memory acquired directly from allocators or memory
327326 /// mapped files *may* be too large to handle with this function.
328327 ///
329- /// Consider using [`wrapping_offset_from`] instead if these constraints are
330- /// difficult to satisfy. The only advantage of this method is that it
331- /// enables more aggressive compiler optimizations.
332- ///
333328 /// # Panics
334329 ///
335330 /// This function panics if `T` is a Zero-Sized Type ("ZST").
0 commit comments