-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Stabilize const ptr::write*
and mem::replace
#130954
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
const_mut_refs
-dependent APIconst_mut_refs
-dependent API
Note that because the Also note that there are already existing PRs for most of the slice-related API, so I did not attempt to include any of them except the one that can be expressed via slice syntax: the rest have even harsher dependency orderings. I will revise this PR appropriately if any of the FCPs garners objections. |
cc @rust-lang/wg-const-eval As described in the PR message, the |
There's in fact 3 intrinsics marked as const-stable here (meaning they are indirectly exposed to stable const code), which needs wg-const-eval approval, and t-lang should be in the loop as well:
None of them do anything odd. In fact @rust-lang/lang this should be an easy one. |
Ah, I figured the |
It's not clear at all from the stable library surface whether new intrinsics are involved. :) |
☔ The latest upstream changes (presumably #130964) made this pull request unmergeable. Please resolve the merge conflicts. |
a377b36
to
5f72cba
Compare
@workingjubilee is there a reason #111774 is not included in this PR? |
@rustbot labels -I-lang-nominated We discussed this in the meeting today... and it's now in FCP. |
const_mut_refs
-dependent APIptr::write*
and mem::replace
5f72cba
to
24a21e3
Compare
☔ The latest upstream changes (presumably #131269) made this pull request unmergeable. Please resolve the merge conflicts. |
24a21e3
to
d9e359c
Compare
☔ The latest upstream changes (presumably #131275) made this pull request unmergeable. Please resolve the merge conflicts. |
d9e359c
to
508d9cf
Compare
☔ The latest upstream changes (presumably #131573) made this pull request unmergeable. Please resolve the merge conflicts. |
This is an implicit requirement of stabilizing `const_ptr_write`. Const-stabilizes the internal `core::intrinsics`: - `forget`
Const-stabilizes: - `write` - `write_bytes` - `write_unaligned` In the following paths: - `core::ptr` - `core::ptr::NonNull` - pointer `<*mut T>` Const-stabilizes the internal `core::intrinsics`: - `write_bytes` - `write_via_move`
Depends on stabilizing `const_ptr_write`. Const-stabilizes: - `core::mem::replace` - `core::ptr::replace`
508d9cf
to
187c8b0
Compare
r=me once FCP is officially over |
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=RalfJung |
Rollup of 7 pull requests Successful merges: - rust-lang#130870 (Add suggestion for removing invalid path sep `::` in fn def) - rust-lang#130954 (Stabilize const `ptr::write*` and `mem::replace`) - rust-lang#131233 (std: fix stdout-before-main) - rust-lang#131590 (yeet some clones) - rust-lang#131596 (mark InterpResult as must_use) - rust-lang#131597 (Take a display name for `tool_check_step!`) - rust-lang#131605 (`LLVMConstInt` only allows integer types) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#130954 - workingjubilee:stabilize-const-mut-fn, r=RalfJung Stabilize const `ptr::write*` and `mem::replace` Since `const_mut_refs` and `const_refs_to_cell` have been stabilized, we may now also stabilize the ability to write to places during const evaluation inside our library API. So, we now propose the `const fn` version of `ptr::write` and its variants. This allows us to also stabilize `mem::replace` and `ptr::replace`. - const `mem::replace`: rust-lang#83164 (comment) - const `ptr::write{,_bytes,_unaligned}`: rust-lang#86302 (comment) Their implementation requires an additional internal stabilization of `const_intrinsic_forget`, which is required for `*::write*` and thus `*::replace`. Thus we const-stabilize the internal intrinsics `forget`, `write_bytes`, and `write_via_move`.
Since
const_mut_refs
andconst_refs_to_cell
have been stabilized, we may now also stabilize the ability to write to places during const evaluation inside our library API. So, we now propose theconst fn
version ofptr::write
and its variants. This allows us to also stabilizemem::replace
andptr::replace
.mem::replace
: Tracking Issue for const_replace #83164 (comment)ptr::write{,_bytes,_unaligned}
: Tracking Issue for const_ptr_write #86302 (comment)Their implementation requires an additional internal stabilization of
const_intrinsic_forget
, which is required for*::write*
and thus*::replace
. Thus we const-stabilize the internal intrinsicsforget
,write_bytes
, andwrite_via_move
.