about summary refs log tree commit diff
path: root/tests/ui/union/union-derive-eq.rs
blob: 085262a72a18f18bd327647747bcbcf855e0e820 (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
25
26
27
28
29
30
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)

#[derive(Eq)] // OK
union U1 {
    a: u8,
}

impl PartialEq for U1 {
    fn eq(&self, rhs: &Self) -> bool {
        true
    }
}

#[derive(PartialEq, Copy, Clone)]
struct PartialEqNotEq;

#[derive(Eq)]
union U2 {
    a: PartialEqNotEq, //~ ERROR the trait bound `PartialEqNotEq: Eq` is not satisfied
}

impl PartialEq for U2 {
    fn eq(&self, rhs: &Self) -> bool {
        true
    }
}

fn main() {}