-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Tracking Issue for const_replace #83164
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
Comments
This comment was marked as resolved.
This comment was marked as resolved.
status on this? is any help needed? |
@rust-lang/libs-api I think this is ready to be stabilized, given that const_mut_refs is in FCP. :) This is about const-stabilizing two already-stable functions: mod mem {
pub const fn replace<T>(dest: &mut T, src: T) -> T;
}
mod ptr {
pub const unsafe fn replace<T>(dst: *mut T, mut src: T) -> T;
} |
@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. |
@Amanieu @BurntSushi @joshtriplett @m-ou-se would be nice to get this (and some of the other |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
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. |
…-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`.
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`.
…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)
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)
Feature gate:
#![feature(const_replace)]
This is a tracking issue for making the functions
mem::replace
andptr::replace
const fn
.Public API
Steps / History
copy
related functions #83091ptr::write*
andmem::replace
#130954Unresolved Questions
The text was updated successfully, but these errors were encountered: