You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected to see this happen: the code should compile successfully, or print a better diagnostic
Instead, this happened: The following compile error:
Compiling playground v0.0.1 (/playground)
error[[E0204]](https://doc.rust-lang.org/nightly/error-index.html#E0204): the trait `Copy` may not be implemented for this type
--> src/main.rs:9:7
|
6 | rc: Rc<u32>,
| ----------- this field does not implement `Copy`
...
9 | impl !Copy for Foo { }
| ^^^^
For more information about this error, try `rustc --explain E0204`.
error: could not compile `playground` due to previous error
I think this is a bug, and that the code ought to compile.
If not, then at the very least, the error message could be improved.
Currently, the error message explains why rustc is not able to implement Copy. But of course, I am trying to implement !Copy, as a declaration that Copy should not or will not ever be implemented for Foo. So I expect the error message should explain why I cannot implement !Copy.
…pls, r=lcnr
Allow more `!Copy` impls
You can already implement `!Copy` for a lot of types (with `#![feature(negative_impls)]`). However, before this PR you could not implement `!Copy` for ADTs whose fields don't implement `Copy` which didn't make any sense. Further, you couldn't implement `!Copy` for types impl'ing `Drop` (equally nonsensical).
`@rustbot` label T-types F-negative_impls
Fixesrust-lang#101836.
r? types
I tried this code on nightly:
I expected to see this happen: the code should compile successfully, or print a better diagnostic
Instead, this happened: The following compile error:
I think this is a bug, and that the code ought to compile.
If not, then at the very least, the error message could be improved.
Currently, the error message explains why rustc is not able to implement
Copy
. But of course, I am trying to implement!Copy
, as a declaration thatCopy
should not or will not ever be implemented forFoo
. So I expect the error message should explain why I cannot implement!Copy
.Playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=546c5fb5b177ac8a111ff2c9bceec503
The text was updated successfully, but these errors were encountered: