-
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
Tracking Issue for const_cell #131283
Comments
make Cell unstably const Now that we can do interior mutability in `const`, most of the Cell API can be `const fn`. :) The main exception is `set`, because it drops the old value. So from const context one has to use `replace`, which delegates the responsibility for dropping to the caller. Tracking issue: rust-lang#131283 `as_array_of_cells` is itself still unstable to I added the const-ness to the feature gate for that function and not to `const_cell`, Cc rust-lang#88248. r? libs-api
Rollup merge of rust-lang#131281 - RalfJung:const-cell, r=Amanieu make Cell unstably const Now that we can do interior mutability in `const`, most of the Cell API can be `const fn`. :) The main exception is `set`, because it drops the old value. So from const context one has to use `replace`, which delegates the responsibility for dropping to the caller. Tracking issue: rust-lang#131283 `as_array_of_cells` is itself still unstable to I added the const-ness to the feature gate for that function and not to `const_cell`, Cc rust-lang#88248. r? libs-api
@rust-lang/libs-api @rust-lang/wg-const-eval I see no reason to wait any longer, so I propose we stabilize the use of // core::cell
impl<T> Cell<T> {
pub const fn replace(&self, val: T) -> T;
}
impl<T: Copy> Cell<T> {
pub const fn get(&self) -> T;
}
impl<T: ?Sized> Cell<T> {
pub const fn get_mut(&mut self) -> &mut T;
pub const fn from_mut(t: &mut T) -> &Cell<T>;
}
impl<T> Cell<[T]> {
pub const fn as_slice_of_cells(&self) -> &[Cell<T>];
} Unfortunately, |
In the libs-api call last week, we (mostly @Amanieu and I) talked about and agreed on doing libs-api stabilization FCPs on the stabilization PRs rather than on the tracking issues. This lets the team look at exactly what will be stabilized, it helps avoid the skew that can sometimes happen between what gets FCPed and what goes up in the PR, and it aligns the process with what lang does. While the risk of skew seems low in this particular case, perhaps it'd be better to go ahead and put up the stabilization PR for this and nominate that. As you say, it does seem time to do these. |
Okay, I will prepare a PR when I find some time. The library tracking issue template should then be adjusted to make it clear that the FCP should happen in the stabilization PR :) |
PR is up at #137928 |
@traviscross should the documentation at https://rustc-dev-guide.rust-lang.org/stability.html#stabilizing-a-library-feature be updated to reflect this new policy? Or is it still in the "experimental" and "on a case-by-case basis" state? |
Probably it should, yes. (It's @Amanieu's call, but he seemed settled on it when we talked. We discussed whether any documentation would need to be updated, but that page and the tracking issue template didn't immediately come to mind, so we both just agreed we'd start to tell people to do it this way.) |
Feature gate:
#![feature(const_cell)]
This is a tracking issue for using
Cell
in a const context.Public API
Steps / History
Unresolved Questions
Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩
The text was updated successfully, but these errors were encountered: