diff options
| author | Ralf Jung <post@ralfj.de> | 2025-07-27 17:00:31 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-07-27 17:00:31 +0200 |
| commit | d12ecde365efcf6ee4eb74fb6cfdd8314ab9fec4 (patch) | |
| tree | 4fdceed2b25a2f1ab26341188df2930e5e07dca3 /library/core | |
| parent | eed187cfce988dd669b7d9161f324433e64358ee (diff) | |
| download | rust-d12ecde365efcf6ee4eb74fb6cfdd8314ab9fec4.tar.gz rust-d12ecde365efcf6ee4eb74fb6cfdd8314ab9fec4.zip | |
constify with_exposed_provenance
Diffstat (limited to 'library/core')
| -rw-r--r-- | library/core/src/ptr/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index dbe3999b4a4..1a2a5182567 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -974,9 +974,10 @@ pub const fn dangling_mut<T>() -> *mut T { #[must_use] #[inline(always)] #[stable(feature = "exposed_provenance", since = "1.84.0")] +#[rustc_const_unstable(feature = "const_exposed_provenance", issue = "144538")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[allow(fuzzy_provenance_casts)] // this *is* the explicit provenance API one should use instead -pub fn with_exposed_provenance<T>(addr: usize) -> *const T { +pub const fn with_exposed_provenance<T>(addr: usize) -> *const T { addr as *const T } @@ -1014,9 +1015,10 @@ pub fn with_exposed_provenance<T>(addr: usize) -> *const T { #[must_use] #[inline(always)] #[stable(feature = "exposed_provenance", since = "1.84.0")] +#[rustc_const_unstable(feature = "const_exposed_provenance", issue = "144538")] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces #[allow(fuzzy_provenance_casts)] // this *is* the explicit provenance API one should use instead -pub fn with_exposed_provenance_mut<T>(addr: usize) -> *mut T { +pub const fn with_exposed_provenance_mut<T>(addr: usize) -> *mut T { addr as *mut T } |
