diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2022-04-03 13:19:30 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2022-04-03 13:19:30 -0700 |
| commit | 4d37d1f4226bd92bf6c129977357afd50993cf0a (patch) | |
| tree | a4d302c8923032b476de7ee265b063d4f0fd33fc | |
| parent | 90722811c8818b1ce4c7819dac41f22837fa98c6 (diff) | |
| download | rust-4d37d1f4226bd92bf6c129977357afd50993cf0a.tar.gz rust-4d37d1f4226bd92bf6c129977357afd50993cf0a.zip | |
Refer to the `exposed` versions of the methods instead
Changing to those doesn't introduce any new unsoundness over the existing ones, so they're the better "if you won't want to think about it" replacement. But also mention the strict provenance APIs, as that's what we'd rather they use instead.
| -rw-r--r-- | library/core/src/ptr/const_ptr.rs | 9 | ||||
| -rw-r--r-- | library/core/src/ptr/mut_ptr.rs | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index e460a7f3b1e..2c371f635ab 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -119,7 +119,11 @@ impl<T: ?Sized> *const T { /// assert_eq!(p1.to_bits() - p0.to_bits(), 4); /// ``` #[unstable(feature = "ptr_to_from_bits", issue = "91126")] - #[rustc_deprecated(since = "1.62", reason = "replaced by the `addr` method")] + #[rustc_deprecated( + since = "1.62", + reason = "replaced by the `exposed_addr` method, or update your code \ + to follow the strict provenance rules using its APIs" + )] pub fn to_bits(self) -> usize where T: Sized, @@ -143,7 +147,8 @@ impl<T: ?Sized> *const T { #[unstable(feature = "ptr_to_from_bits", issue = "91126")] #[rustc_deprecated( since = "1.62", - reason = "replaced by the `with_addr` method or the `ptr::invalid` function" + reason = "replaced by the `ptr::from_exposed_addr` function, or update \ + your code to follow the strict provenance rules using its APIs" )] #[allow(fuzzy_provenance_casts)] // this is an unstable and semi-deprecated cast function pub fn from_bits(bits: usize) -> Self diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index 351012e6ffc..79682531562 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -125,7 +125,11 @@ impl<T: ?Sized> *mut T { /// assert_eq!(p1.to_bits() - p0.to_bits(), 4); /// ``` #[unstable(feature = "ptr_to_from_bits", issue = "91126")] - #[rustc_deprecated(since = "1.62", reason = "replaced by the `addr` method")] + #[rustc_deprecated( + since = "1.62", + reason = "replaced by the `exposed_addr` method, or update your code \ + to follow the strict provenance rules using its APIs" + )] pub fn to_bits(self) -> usize where T: Sized, @@ -149,7 +153,8 @@ impl<T: ?Sized> *mut T { #[unstable(feature = "ptr_to_from_bits", issue = "91126")] #[rustc_deprecated( since = "1.62", - reason = "replaced by the `with_addr` method or the `ptr::invalid_mut` function" + reason = "replaced by the `ptr::from_exposed_addr_mut` function, or \ + update your code to follow the strict provenance rules using its APIs" )] #[allow(fuzzy_provenance_casts)] // this is an unstable and semi-deprecated cast function pub fn from_bits(bits: usize) -> Self |
