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 1651: Extend Cell to non-Copy types #39264

Closed
aturon opened this issue Jan 23, 2017 · 10 comments
Closed

Tracking issue for RFC 1651: Extend Cell to non-Copy types #39264

aturon opened this issue Jan 23, 2017 · 10 comments
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@aturon
Copy link
Member

aturon commented Jan 23, 2017

RFC

@aturon aturon added A-libs B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. labels Jan 23, 2017
wesleywiser added a commit to wesleywiser/rust that referenced this issue Jan 25, 2017
@SimonSapin
Copy link
Contributor

#39287 broke a library of mine where I had code like this:

trait Take<T> {
    fn take(&self) -> Option<T>;
}

impl<T: Copy> Take<T> for Cell<Option<T>> {
    fn take(&self) -> Option<T> {
        let value = self.get();
        self.set(None);
        value
    }
}

foo.take() calls that used to call this trait method now call the new inherent method, but since that’s unstable the crate didn’t build until I added #![feature(move_cell)]. After that I could remove the trait since the new method has the same behavior.

Anyway, this is just FYI. If we don’t want this kind of breakage we can’t add any new method to existing std types ever, so that doesn’t sound viable. If the new method had had different behavior or if I wanted to keep supporting older compilers, it wouldn’t be too hard to rename my trait’s method or use UFCS.

@alexcrichton
Copy link
Member

Yeah in general we reserve the right to break downstream code with differences in method resolution because the downstream code can always be written in an "elaborated" form which works on all compilers (e.g. using ufcs).

If a change to the standard library breaks an excessive amount of code in the ecosystem, though, then we'd need to take the steps much more purposefully.

@SimonSapin
Copy link
Contributor

If a change to the standard library breaks an excessive amount of code in the ecosystem

Sounds good.

Again, I don’t expect anything to change here and only made the previous comment to let people know this happened. I made this particular crate as an experiment, I don’t know of anyone actually using it.

@alexcrichton alexcrichton added B-unstable Blocker: Implemented in the nightly compiler and unstable. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed B-RFC-approved Blocker: Approved by a merged RFC but not yet implemented. labels Feb 8, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 13, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 13, 2017
RalfJung added a commit to RalfJung/rust that referenced this issue Feb 13, 2017
RalfJung added a commit to RalfJung/rust that referenced this issue Feb 14, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 15, 2017
Allow more Cell methods for non-Copy types

Clearly, `get_mut` is safe for any `T`. The other two only provide unsafe pointers anyway.

The only remaining inherent method with `Copy` bound is `get`, which sounds about right to me.

I found the order if `impl` blocks in the file a little weird (first inherent impl, then some trait impls, then another inherent impl), but didn't change it to keep the diff small.

Contributes to rust-lang#39264
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 15, 2017
Allow more Cell methods for non-Copy types

Clearly, `get_mut` is safe for any `T`. The other two only provide unsafe pointers anyway.

The only remaining inherent method with `Copy` bound is `get`, which sounds about right to me.

I found the order if `impl` blocks in the file a little weird (first inherent impl, then some trait impls, then another inherent impl), but didn't change it to keep the diff small.

Contributes to rust-lang#39264
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 16, 2017
Allow more Cell methods for non-Copy types

Clearly, `get_mut` is safe for any `T`. The other two only provide unsafe pointers anyway.

The only remaining inherent method with `Copy` bound is `get`, which sounds about right to me.

I found the order if `impl` blocks in the file a little weird (first inherent impl, then some trait impls, then another inherent impl), but didn't change it to keep the diff small.

Contributes to rust-lang#39264
frewsxcv added a commit to frewsxcv/rust that referenced this issue Feb 16, 2017
Allow more Cell methods for non-Copy types

Clearly, `get_mut` is safe for any `T`. The other two only provide unsafe pointers anyway.

The only remaining inherent method with `Copy` bound is `get`, which sounds about right to me.

I found the order if `impl` blocks in the file a little weird (first inherent impl, then some trait impls, then another inherent impl), but didn't change it to keep the diff small.

Contributes to rust-lang#39264
@aturon
Copy link
Member Author

aturon commented Feb 23, 2017

Given that the core changes to the bounds on existing methods were instantly stable, it doesn't make a lot of sense to keep take and replace as unstable. I propose we immediately stabilize these APIs.

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Feb 23, 2017

Team member @aturon has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once these reviewers reach consensus, 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.

@alexcrichton
Copy link
Member

ping @BurntSushi (checkbox)

@rfcbot
Copy link

rfcbot commented Feb 28, 2017

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Feb 28, 2017
@rfcbot
Copy link

rfcbot commented Mar 10, 2017

The final comment period is now complete.

@SimonSapin
Copy link
Contributor

What’s the next step here? Batch stabilization PR near the end of the release cycle?

@aturon
Copy link
Member Author

aturon commented Mar 15, 2017

@SimonSapin Yep, I'm preparing one right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants