Files
rust/tests/ui/traits/copy-requires-all-fields-copy.rs

25 lines
481 B
Rust
Raw Normal View History

2025-07-01 02:09:12 +05:00
//! Test that `Copy` cannot be implemented if any field doesn't implement `Copy`.
struct CantCopyThis;
struct IWantToCopyThis {
but_i_cant: CantCopyThis,
}
impl Copy for IWantToCopyThis {}
2023-03-07 23:55:51 +00:00
//~^ ERROR the trait `Copy` cannot be implemented for this type
enum CantCopyThisEither {
A,
B,
}
enum IWantToCopyThisToo {
ButICant(CantCopyThisEither),
}
impl Copy for IWantToCopyThisToo {}
2023-03-07 23:55:51 +00:00
//~^ ERROR the trait `Copy` cannot be implemented for this type
fn main() {}