summaryrefslogtreecommitdiffstats
path: root/tests/ui/union/union-derive.rs
blob: 652a6b24cff26d8a67c041b76bc47cd4212d9557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Most traits cannot be derived for unions.

#[derive(
    PartialEq, //~ ERROR this trait cannot be derived for unions
    PartialOrd, //~ ERROR this trait cannot be derived for unions
    Ord, //~ ERROR this trait cannot be derived for unions
    Hash, //~ ERROR this trait cannot be derived for unions
    Default, //~ ERROR this trait cannot be derived for unions
    Debug, //~ ERROR this trait cannot be derived for unions
)]
union U {
    a: u8,
    b: u16,
}

fn main() {}