rust/library/core/src/ptr
Matthias Krüger 0b342873e3
Rollup merge of #136877 - Sky9x:const-inherent-ptr-replace, r=jhpratt
Fix missing const for inherent pointer `replace` methods

`ptr::replace` (the free fn) is already const stable. However, there are inherent convenience methods on `*mut T` and `NonNull<T>`, allowing you to write eg. `unsafe { foo.replace(bar) }` where `foo` is `*mut T` or `NonNull<T>`.

It seems const was never added to the inherent method (likely oversight), so this PR adds it.
I don't believe this needs another[^1] FCP as the inherent methods are already stable and `ptr::replace` is already const stable, so this adds no new API.

Original tracking issue: #83164
`ptr::replace` constified in #83091
`ptr::replace` const stabilized in #130954

[^1]: `const_replace` FCP completed: https://github.com/rust-lang/rust/issues/83164#issuecomment-2385670050
2025-04-05 19:40:23 +02:00
..
alignment.rs library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
const_ptr.rs std: Explain range follows standard half-open range in offset 2025-03-28 22:28:48 +08:00
metadata.rs Rollup merge of #135080 - Enselic:debug-ptr-metadata, r=thomcc 2025-03-16 13:19:51 +08:00
mod.rs library: Use size_of from the prelude instead of imported 2025-03-06 20:20:38 -08:00
mut_ptr.rs Rollup merge of #136877 - Sky9x:const-inherent-ptr-replace, r=jhpratt 2025-04-05 19:40:23 +02:00
non_null.rs Rollup merge of #136877 - Sky9x:const-inherent-ptr-replace, r=jhpratt 2025-04-05 19:40:23 +02:00
unique.rs stabilize const_nonnull_new 2024-12-10 11:29:01 +01:00