-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Fix missing const for inherent pointer replace
methods
#136877
base: master
Are you sure you want to change the base?
Conversation
@rustbot label +T-libs-api |
I agree that this seems like an oversight and doesn't need another FCP, but I'll defer to @rust-lang/libs-api as it is ultimately their decision. |
@rfcbot fcp merge |
Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
ptr::replace
(the free fn) is already const stable. However, there are inherent convenience methods on*mut T
andNonNull<T>
, allowing you to write eg.unsafe { foo.replace(bar) }
wherefoo
is*mut T
orNonNull<T>
.It seems const was never added to the inherent method (likely oversight), so this PR adds it.
I don't believe this needs another1 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 #83091ptr::replace
const stabilized in #130954Footnotes
const_replace
FCP completed: https://github.com/rust-lang/rust/issues/83164#issuecomment-2385670050 ↩