sub_ptr()
is equivalent to usize::try_from().unwrap_unchecked()
, not usize::from().unwrap_unchecked()
.
`usize::from()` gives a `usize`, not `Result<usize>`, and `usize: From<isize>` is not implemented.
This commit is contained in:
parent
6b3cd03fdb
commit
236f8231a6
2 changed files with 2 additions and 2 deletions
|
@ -731,7 +731,7 @@ impl<T: ?Sized> *const T {
|
|||
/// This computes the same value that [`offset_from`](#method.offset_from)
|
||||
/// would compute, but with the added precondition that the offset is
|
||||
/// guaranteed to be non-negative. This method is equivalent to
|
||||
/// `usize::from(self.offset_from(origin)).unwrap_unchecked()`,
|
||||
/// `usize::try_from(self.offset_from(origin)).unwrap_unchecked()`,
|
||||
/// but it provides slightly more information to the optimizer, which can
|
||||
/// sometimes allow it to optimize slightly better with some backends.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue