diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-06-22 14:53:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-22 14:53:52 +0200 |
| commit | 35ecb2629783d413d8b840bca3512ad861b7cbfe (patch) | |
| tree | 503514544d8cf12e38bc5a1f947732c75783dd3a | |
| parent | d22b80dc0c750c136e0935c2a2498a2bb752650f (diff) | |
| parent | 467415d50cdf8a0d15ec19dc63251443b35d4cee (diff) | |
| download | rust-35ecb2629783d413d8b840bca3512ad861b7cbfe.tar.gz rust-35ecb2629783d413d8b840bca3512ad861b7cbfe.zip | |
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
| -rw-r--r-- | src/libcore/ptr/const_ptr.rs | 6 | ||||
| -rw-r--r-- | src/libcore/ptr/mut_ptr.rs | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/libcore/ptr/const_ptr.rs b/src/libcore/ptr/const_ptr.rs index e39d18d7733..acc09ddc014 100644 --- a/src/libcore/ptr/const_ptr.rs +++ b/src/libcore/ptr/const_ptr.rs @@ -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 diff --git a/src/libcore/ptr/mut_ptr.rs b/src/libcore/ptr/mut_ptr.rs index 40b5e4e2234..2bbeb95965e 100644 --- a/src/libcore/ptr/mut_ptr.rs +++ b/src/libcore/ptr/mut_ptr.rs @@ -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) } |
