1 // This is part of a set of tests exploring the different ways a
2 // structural-match ADT might try to hold a
3 // non-structural-match in hidden manner that lets matches
4 // through that we had intended to reject.
6 // See discussion on rust-lang/rust#62307 and rust-lang/rust#62339
8 struct NoDerive(#[allow(unused_tuple_struct_fields)] i32);
10 // This impl makes NoDerive irreflexive.
11 impl PartialEq for NoDerive { fn eq(&self, _: &Self) -> bool { false } }
13 impl Eq for NoDerive { }
15 #[derive(PartialEq, Eq)]
16 struct WrapInline(NoDerive);
18 const WRAP_DIRECT_INLINE: WrapInline = WrapInline(NoDerive(0));
21 match WRAP_DIRECT_INLINE {
22 WRAP_DIRECT_INLINE => { panic!("WRAP_DIRECT_INLINE matched itself"); }
23 //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
24 _ => { println!("WRAP_DIRECT_INLINE did not match itself"); }