Rollup merge of #73580 - RalfJung:deprecate-wrapping-offset-from, r=Amanieu
deprecate wrapping_offset_from As per https://github.com/rust-lang/rust/issues/41079#issuecomment-433140733 which seems like a consensus. r? @Amanieu
This commit is contained in:
commit
35ecb26297
2 changed files with 13 additions and 0 deletions
|
@ -330,6 +330,12 @@ impl<T: ?Sized> *const T {
|
|||
/// assert_eq!(ptr2.wrapping_offset_from(ptr1), 2);
|
||||
/// ```
|
||||
#[unstable(feature = "ptr_wrapping_offset_from", issue = "41079")]
|
||||
#[rustc_deprecated(
|
||||
since = "1.46.0",
|
||||
reason = "Pointer distances across allocation \
|
||||
boundaries are not typically meaningful. \
|
||||
Use integer subtraction if you really need this."
|
||||
)]
|
||||
#[inline]
|
||||
pub fn wrapping_offset_from(self, origin: *const T) -> isize
|
||||
where
|
||||
|
|
|
@ -380,11 +380,18 @@ impl<T: ?Sized> *mut T {
|
|||
/// assert_eq!(ptr2.wrapping_offset_from(ptr1), 2);
|
||||
/// ```
|
||||
#[unstable(feature = "ptr_wrapping_offset_from", issue = "41079")]
|
||||
#[rustc_deprecated(
|
||||
since = "1.46.0",
|
||||
reason = "Pointer distances across allocation \
|
||||
boundaries are not typically meaningful. \
|
||||
Use integer subtraction if you really need this."
|
||||
)]
|
||||
#[inline]
|
||||
pub fn wrapping_offset_from(self, origin: *const T) -> isize
|
||||
where
|
||||
T: Sized,
|
||||
{
|
||||
#[allow(deprecated_in_future, deprecated)]
|
||||
(self as *const T).wrapping_offset_from(origin)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue