-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Comments
#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
}
}
Anyway, this is just FYI. If we don’t want this kind of breakage we can’t add any new method to existing |
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. |
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. |
Add `swap` method for `Cell` Addition to rust-lang#39264 r? @alexcrichton
Add `swap` method for `Cell` Addition to rust-lang#39264 r? @alexcrichton
Contributes to rust-lang#39264
Contributes to rust-lang#39264
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
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
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
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
Given that the core changes to the bounds on existing methods were instantly stable, it doesn't make a lot of sense to keep @rfcbot fcp merge |
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. |
ping @BurntSushi (checkbox) |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period is now complete. |
What’s the next step here? Batch stabilization PR near the end of the release cycle? |
@SimonSapin Yep, I'm preparing one right now. |
RFC
The text was updated successfully, but these errors were encountered: