-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
base: master
Are you sure you want to change the base?
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? |
@rfcbot fcp merge |
Team member @traviscross 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! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
There is some interest in having some of these APIs available at the same time as Considering libs-api already has complete or near-complete FCPs for these and lang already completed the FCP for |
IMO we should just merge what's FCP'd until then. We can let everything that needs the intrinsics slip to the next release. (That's just const_replace and const_ptr_write, I think?) |
Ah, I did not realize that the lang FCP was related to the intrinsics, thanks for the clarification. Your suggestion sounds reasonable. |
@rfcbot reviewed Agreed there's nothing lang-concerning here. |
@rfcbot reviewed Sounds reasonable to me. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@rfcbot reviewed |
@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. |
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`
d9e359c
to
508d9cf
Compare
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
.