-
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
Require that types cannot implement both Drop and Copy. #20631
Conversation
r? @nick29581 (rust_highfive has picked a reviewer for you, use r? to override) |
@huonw it occurs to me that this check might not quite work for generic structs -- but there is some question as to the correct behavior of Drop in the case of generic structs anyhow (i.e., if you have struct Foo(T), is it ok to impl<T:Bar> Drop for Foo?). Right now it's a moot point because #[unsafe_dtor] is required for generic structs anyway, but eventually that will not be true. (promoting to a comment on the PR so it doesn't go away after rebasing etc) |
So I think we want to be careful about generic structs, but that's probably a separate PR. Hence r+. |
Opt-in built-in traits allowed one to explicitly implement both `Drop` and `Copy` for a type. This can theoretically make some sense, but the current implementation means it is codegened totally incorrectly which can lead to memory unsafety, so this feature is disabled for now. Fixes #20126.
8ba4cfc
to
0ea534f
Compare
Opt-in built-in traits allowed one to explicitly implement both `Drop` and `Copy` for a type. This can theoretically make some sense, but the current implementation means it is codegened totally incorrectly which can lead to memory unsafety, so this feature is disabled for now. Fixes #20126.
Opt-in built-in traits allowed one to explicitly implement both `Drop` and `Copy` for a type. This can theoretically make some sense, but the current implementation means it is codegened totally incorrectly which can lead to memory unsafety, so this feature is disabled for now. Fixes rust-lang#20126.
0ea534f
to
3c1ca17
Compare
Opt-in built-in traits allowed one to explicitly implement both `Drop` and `Copy` for a type. This can theoretically make some sense, but the current implementation means it is codegened totally incorrectly which can lead to memory unsafety, so this feature is disabled for now. Fixes #20126.
Opt-in built-in traits allowed one to explicitly implement both
Drop
and
Copy
for a type. This can theoretically make some sense, but thecurrent implementation means it is codegened totally incorrectly which
can lead to memory unsafety, so this feature is disabled for now.
Fixes #20126.