about summary refs log tree commit diff
path: root/tests/ui/traits/copy-requires-all-fields-copy.rs
blob: 8c829a7382b3ea30690257f06d7d90e06aecffcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! 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 {}
//~^ ERROR the trait `Copy` cannot be implemented for this type

enum CantCopyThisEither {
    A,
    B,
}

enum IWantToCopyThisToo {
    ButICant(CantCopyThisEither),
}

impl Copy for IWantToCopyThisToo {}
//~^ ERROR the trait `Copy` cannot be implemented for this type

fn main() {}