@@ -240,8 +240,8 @@ impl<T: ?Sized> *const T {
240
240
/// different allocated object. Note that in Rust,
241
241
/// every (stack-allocated) variable is considered a separate allocated object.
242
242
///
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
245
245
/// unless `x` and `y` point into the same allocated object.
246
246
///
247
247
/// Compared to [`offset`], this method basically delays the requirement of staying
@@ -292,7 +292,6 @@ impl<T: ?Sized> *const T {
292
292
/// This function is the inverse of [`offset`].
293
293
///
294
294
/// [`offset`]: #method.offset
295
- /// [`wrapping_offset_from`]: #method.wrapping_offset_from
296
295
///
297
296
/// # Safety
298
297
///
@@ -326,10 +325,6 @@ impl<T: ?Sized> *const T {
326
325
/// Extension. As such, memory acquired directly from allocators or memory
327
326
/// mapped files *may* be too large to handle with this function.
328
327
///
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
- ///
333
328
/// # Panics
334
329
///
335
330
/// This function panics if `T` is a Zero-Sized Type ("ZST").
0 commit comments