fix dead links to wrapping_offset_from
This commit is contained in:
@@ -240,8 +240,8 @@ impl<T: ?Sized> *const T {
|
|||||||
/// different allocated object. Note that in Rust,
|
/// different allocated object. Note that in Rust,
|
||||||
/// every (stack-allocated) variable is considered a separate allocated object.
|
/// every (stack-allocated) variable is considered a separate allocated object.
|
||||||
///
|
///
|
||||||
/// In other words, `x.wrapping_offset(y.wrapping_offset_from(x))` is
|
/// In other words, `x.wrapping_offset((y as usize).wrapping_sub(x as usize) / size_of::<T>())`
|
||||||
/// *not* the same as `y`, and dereferencing it is undefined behavior
|
/// is *not* the same as `y`, and dereferencing it is undefined behavior
|
||||||
/// unless `x` and `y` point into the same allocated object.
|
/// unless `x` and `y` point into the same allocated object.
|
||||||
///
|
///
|
||||||
/// Compared to [`offset`], this method basically delays the requirement of staying
|
/// Compared to [`offset`], this method basically delays the requirement of staying
|
||||||
@@ -292,7 +292,6 @@ impl<T: ?Sized> *const T {
|
|||||||
/// This function is the inverse of [`offset`].
|
/// This function is the inverse of [`offset`].
|
||||||
///
|
///
|
||||||
/// [`offset`]: #method.offset
|
/// [`offset`]: #method.offset
|
||||||
/// [`wrapping_offset_from`]: #method.wrapping_offset_from
|
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
@@ -326,10 +325,6 @@ impl<T: ?Sized> *const T {
|
|||||||
/// Extension. As such, memory acquired directly from allocators or memory
|
/// Extension. As such, memory acquired directly from allocators or memory
|
||||||
/// mapped files *may* be too large to handle with this function.
|
/// mapped files *may* be too large to handle with this function.
|
||||||
///
|
///
|
||||||
/// Consider using [`wrapping_offset_from`] instead if these constraints are
|
|
||||||
/// difficult to satisfy. The only advantage of this method is that it
|
|
||||||
/// enables more aggressive compiler optimizations.
|
|
||||||
///
|
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// This function panics if `T` is a Zero-Sized Type ("ZST").
|
/// This function panics if `T` is a Zero-Sized Type ("ZST").
|
||||||
|
|||||||
@@ -246,8 +246,8 @@ impl<T: ?Sized> *mut T {
|
|||||||
/// different allocated object. Note that in Rust,
|
/// different allocated object. Note that in Rust,
|
||||||
/// every (stack-allocated) variable is considered a separate allocated object.
|
/// every (stack-allocated) variable is considered a separate allocated object.
|
||||||
///
|
///
|
||||||
/// In other words, `x.wrapping_offset(y.wrapping_offset_from(x))` is
|
/// In other words, `x.wrapping_offset((y as usize).wrapping_sub(x as usize) / size_of::<T>())`
|
||||||
/// *not* the same as `y`, and dereferencing it is undefined behavior
|
/// is *not* the same as `y`, and dereferencing it is undefined behavior
|
||||||
/// unless `x` and `y` point into the same allocated object.
|
/// unless `x` and `y` point into the same allocated object.
|
||||||
///
|
///
|
||||||
/// Compared to [`offset`], this method basically delays the requirement of staying
|
/// Compared to [`offset`], this method basically delays the requirement of staying
|
||||||
@@ -463,7 +463,6 @@ impl<T: ?Sized> *mut T {
|
|||||||
/// This function is the inverse of [`offset`].
|
/// This function is the inverse of [`offset`].
|
||||||
///
|
///
|
||||||
/// [`offset`]: #method.offset-1
|
/// [`offset`]: #method.offset-1
|
||||||
/// [`wrapping_offset_from`]: #method.wrapping_offset_from-1
|
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
///
|
///
|
||||||
@@ -497,10 +496,6 @@ impl<T: ?Sized> *mut T {
|
|||||||
/// Extension. As such, memory acquired directly from allocators or memory
|
/// Extension. As such, memory acquired directly from allocators or memory
|
||||||
/// mapped files *may* be too large to handle with this function.
|
/// mapped files *may* be too large to handle with this function.
|
||||||
///
|
///
|
||||||
/// Consider using [`wrapping_offset_from`] instead if these constraints are
|
|
||||||
/// difficult to satisfy. The only advantage of this method is that it
|
|
||||||
/// enables more aggressive compiler optimizations.
|
|
||||||
///
|
|
||||||
/// # Panics
|
/// # Panics
|
||||||
///
|
///
|
||||||
/// This function panics if `T` is a Zero-Sized Type ("ZST").
|
/// This function panics if `T` is a Zero-Sized Type ("ZST").
|
||||||
|
|||||||
Reference in New Issue
Block a user