1 // This test is illustrating the difference between how failing to derive
2 // `PartialEq` is handled compared to failing to implement it at all.
6 #[derive(PartialEq, Eq)]
7 struct Structural(u32);
9 struct NoPartialEq(u32);
13 // This impl makes NoDerive irreflexive.
14 impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
16 impl Eq for NoDerive { }
18 const NO_DERIVE_NONE: Option<NoDerive> = None;
19 const NO_PARTIAL_EQ_NONE: Option<NoPartialEq> = None;
23 NO_DERIVE_NONE => println!("NO_DERIVE_NONE"),
24 _ => panic!("whoops"),
28 NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
29 //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
30 _ => panic!("whoops"),