-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 RFC 1789: Conversions from &mut T
to &Cell<T>
#43038
Comments
Implement rfc 1789: Conversions from `&mut T` to `&Cell<T>` I'm surprised that RFC 1789 has not been implemented for several months. Tracking issue: #43038 Please note: when I was writing tests for `&Cell<[i32]>`, I found it is not easy to get the length of the contained slice. So I designed a `get_with` method which might be useful for similar cases. This method is not designed in the RFC, and it certainly needs to be reviewed by core team. I think it has some connections with `Cell::update` #50186 , which is also in design phase.
This appears to have been implemented and is sitting behind the as_ref feature flag. Would anyone like to make any motions toward stabilization, or did the long discussion in the implementation PR cast doubts on the design? |
Let’s. @rfcbot fcp merge |
Team member @SimonSapin 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. |
As I understand it, the new API here currently consists of: impl<T: ?Sized> Cell<T> {
pub fn from_mut(t: &mut T) -> &Cell<T>;
}
impl<T> Cell<[T]> {
pub fn as_slice_of_cells(&self) -> &[Cell<T>];
} |
Ping @BurntSushi @aturon @withoutboats do any of you have any concerns with merging this? |
🔔 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. The RFC will be merged soon. |
Stabilization PR: #61620 |
Stabilize Cell::from_mut and as_slice_of_cells FCP: #43038 (comment)
Stabilized in #61620. |
Does someone want to edit the description to check the stabilization checkbox? |
Sure, though IMO the issue being closed already reflects that everything in it is either done or obsolete. |
Why doesn't this return |
Is there a case where this would be useful? I feel that having multiple references to the thing is the point of this API. |
You can trivially convert a |
Is there a way to go from |
So that's the reason why this should return |
This discussion is somewhat academic since
|
I see what you mean. This is a tool for allowing temporary usage through a |
This is a tracking issue for the RFC "Conversions from
&mut T
to&Cell<T>
" (rust-lang/rfcs#1789).Steps:
The text was updated successfully, but these errors were encountered: