-
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
Remove RcMut and Cell and introduce Mutable #9351
Comments
This is interesting because not too long ago we had |
Either way, I think we want a Cell that works more like this Mutable w.r.t borrowing. |
let foo = Cell::new(10);
do spawn {
let foo = foo.take();
....
} Maybe |
Edited to add: The point is indeed to separate the factors. |
It seems a bit unwieldy for the relatively common task of moving things into closures: let foo = Mut::new(Some(10));
do spawn {
let foo = foo.borrow_mut();
let foo = foo.get().take();
...
}
|
if
Edited 12 hours later: My turn to be wrong :-( it's really |
Huh, I didn't know you could specialize impls like that. In any case I like the idea of adding |
For historical reference, the PR that removed Mut: #5678, the removal of which was part of removing mut fields. As I recall the only reason Cell wasn't removed was the problem with closures, and because it was used in Servo? |
@Thiez: |
I'm working on this at https://github.com/blake2-ppc/rust/compare/mutable-t
|
Posted RFC pull request with explanation as #9429 ; I prefer to have a real implementation as basis for discussion. |
These are both gone. |
Fixes rust-lang#9351. Note that this commit reworks that fix for rust-lang#9317. The change is to check that the type implements `AsRef<str>` before regarding `to_string` as an equivalent of `to_owned`. This was suggested by Jarcho in the rust-lang#9317 issue comments. The benefit of this is that it moves some complexity out of `check_other_call_arg` and simplifies the module as a whole.
Fix `unnecessary_to_owned` false positive Fixes rust-lang#9351. Note that this commit reworks that fix for rust-lang#9317. The change is to check that the type implements `AsRef<str>` before regarding `to_string` as an equivalent of `to_owned`. This was suggested by Jarcho in the rust-lang#9317 issue comments. The benefit of this is that it moves some complexity out of `check_other_call_arg` and simplifies the module as a whole. changelog: FP: [`unnecessary_to_owned`]: No longer lints, if type change would cause errors in the caller function
Introduce
Mutable<T>
to implement a dynamic mutable slot, with dynamic borrow check, in once place. ObsoleteCell<T>
andRcMut<T>
(and what about@mut T
? See #7140)For
Mutable<T>
use an implementation with wrapped borrowed pointers to allow for both closured-bracketed and "roaming" borrowed pointers.A working test is https://gist.github.com/anonymous/f007d9b907509c03c17fUpdated, WIP: https://github.com/blake2-ppc/rust/compare/mutable-t
The text was updated successfully, but these errors were encountered: