Closed
Description
struct NoCopy;
enum Test {
MyVariant(NoCopy)
}
impl Copy for Test {}
fn main() {}
Compiling the above code generates the following error:
phantom /tmp $ rustc test.rs
test.rs:7:1: 7:22 error: the trait `Copy` may not be implemented for this type; variant `MyVariant` does not implement `Copy`
test.rs:7 impl Copy for Test {}
^~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
The error mentions that MyVariant
doesn't implement Copy
without pointing to the right type in the constructor that is actually missing the implementation NoCopy
.