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
7 #![warn(indirect_structural_match)]
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 WrapParam<T>(T);
18 const WRAP_DIRECT_PARAM: WrapParam<NoDerive> = WrapParam(NoDerive(0));
21 match WRAP_DIRECT_PARAM {
22 WRAP_DIRECT_PARAM => { panic!("WRAP_DIRECT_PARAM matched itself"); }
23 //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
24 _ => { println!("WRAP_DIRECT_PARAM did not match itself"); }