aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/derive-eq-invalid.rs
blob: b0bf856486d3c84f0efac7602ac75c083b9b986f (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
mod core {
    mod cmp {
        #[lang = "eq"]
        pub trait PartialEq<Rhs: ?Sized = Self> {
            fn eq(&self, other: &Rhs) -> bool;

            fn ne(&self, other: &Rhs) -> bool {
                !self.eq(other)
            }
        }

        pub trait Eq: PartialEq<Self> {
            fn assert_receiver_is_total_eq(&self) {}
        }
    }
}

#[lang = "phantom_data"]
struct PhantomData<T>;

#[lang = "sized"]
trait Sized {}

#[lang = "structural_peq"]
trait StructuralPartialEq {}

#[lang = "structural_teq"]
trait StructuralEq {}

#[derive(PartialEq)]
struct NotEq;

#[derive(Eq, PartialEq)] // { dg-error "bounds not satisfied for NotEq .Eq." }
struct Container(NotEq);

// #[derive(Eq)]
// struct Foo { a: i32 }
// #[derive(Eq)]
// struct Bar(i32);

// #[derive(Eq)]
// enum Baz {
//     A,
//     B(i32),
//     C { a: i32 }
// }

// #[derive(Eq)]
// union Qux {
//     a: i32,
//     b: i64,
// }