mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Rollup merge of #107223 - ChayimFriedman2:patch-5, r=WaffleLapkin
`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:
commit
24066910ca
@ -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.
|
||||
///
|
||||
|
@ -904,7 +904,7 @@ impl<T: ?Sized> *mut 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…
Reference in New Issue
Block a user