Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the unstable ptr_to_from_bits feature #95583

Merged
merged 4 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +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.67",
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,
Expand All @@ -140,6 +145,11 @@ impl<T: ?Sized> *const T {
/// assert_eq!(<*const u8>::from_bits(1), dangling);
/// ```
#[unstable(feature = "ptr_to_from_bits", issue = "91126")]
#[rustc_deprecated(
since = "1.67",
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
where
Expand Down
10 changes: 10 additions & 0 deletions library/core/src/ptr/mut_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +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.67",
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,
Expand All @@ -146,6 +151,11 @@ impl<T: ?Sized> *mut T {
/// assert_eq!(<*mut u8>::from_bits(1), dangling);
/// ```
#[unstable(feature = "ptr_to_from_bits", issue = "91126")]
#[rustc_deprecated(
since = "1.67",
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
where
Expand Down