-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
RFC: changes to implicit copyability #9098
Comments
nominating backwards compat |
Including |
Accepted for backwards-compatible |
I think the current situation is the best compromise between all the competing interests. At the moment, you can explain the copy/move semantics as follows:
Any extra complications at a language level have a very real cost in complexity. |
by the way, |
We now have efficient markers introduced in #11768 for opting out of implicit copyability. Nominating for closure, I don't think we want to modify the rules to opt-in to implicit copyability. |
Note that the marking struct has been renamed to Closing. (There may be other changes in the future that affect this issues, but this ticket on its own can be handled currently via the marker.) |
New lint [`filter_map_bool_then`] Closes rust-lang#9098 changelog: New lint [`filter_map_bool_then`]
Right now any struct that contains only implicitly copyable types is implicitly copyable and there is no way to turn this off.
We need a way to annotate that a struct should not be implicitly copyable at the very least.
I think a better solution would to make the default not to have structs be implicitly copyable unless annotated specifically that they are. That is, the default would be reversed.
This is an issue for things like Option where T is implicitly copyable. It completely changes the semantics of functions like
unwrap()
. Depending on the type of T, this may move or copy.This recently caused a Servo bug where the different between
unwrap()
andwith_mut_ref()
caused an infinite loop:sammykim/servo@7a1493a
The text was updated successfully, but these errors were encountered: