Skip to content
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

Open
aturon opened this Issue Jul 3, 2017 · 4 comments

Comments

Projects
None yet
6 participants
@aturon
Copy link
Member

aturon commented Jul 3, 2017

This is a tracking issue for the RFC "Conversions from &mut T to &Cell<T>" (rust-lang/rfcs#1789).

Steps:

bors added a commit that referenced this issue Jul 23, 2018

Auto merge of #50494 - F001:as_cell, r=alexcrichton
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.
@bstrie

This comment has been minimized.

Copy link
Contributor

bstrie commented Nov 13, 2018

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?

@SimonSapin

This comment has been minimized.

Copy link
Contributor

SimonSapin commented Apr 7, 2019

Let’s.

@rfcbot fcp merge

@rfcbot

This comment has been minimized.

Copy link

rfcbot commented Apr 7, 2019

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.

@dtolnay

This comment has been minimized.

Copy link
Member

dtolnay commented Apr 7, 2019

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>];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.