-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fix missing const for inherent pointer replace
methods
#136877
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
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. 🔔 |
Historical note: This was likely blocked on |
Cc @rust-lang/wg-const-eval (as noted before, please always ping us when proposing a const-stabilization FCP) |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
@bors r+ rollup |
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#136877 (Fix missing const for inherent pointer `replace` methods) - rust-lang#138797 (Fix `ProvenVia` for global where clauses) - rust-lang#139121 (Rename internal module from `statik` to `no_threads`) - rust-lang#139319 (StableMIR: Prepare for refactoring) - rust-lang#139404 (Small smir cleanup) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#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: rust-lang#83164 `ptr::replace` constified in rust-lang#83091 `ptr::replace` const stabilized in rust-lang#130954 [^1]: `const_replace` FCP completed: rust-lang#83164 (comment)
…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: rust-lang#83164 `ptr::replace` constified in rust-lang#83091 `ptr::replace` const stabilized in rust-lang#130954 [^1]: `const_replace` FCP completed: rust-lang#83164 (comment)
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 ↩