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)]
12 // This impl makes NoDerive irreflexive.
13 impl PartialEq
for NoDerive { fn eq(&self, _: &Self) -> bool { false }
}
15 impl Eq
for NoDerive { }
17 #[derive(PartialEq, Eq)]
18 struct WrapInline(NoDerive
);
20 const WRAP_INDIRECT_INLINE
: & &WrapInline
= & &WrapInline(NoDerive(0));
23 match WRAP_INDIRECT_INLINE
{
24 WRAP_INDIRECT_INLINE
=> { panic!("WRAP_INDIRECT_INLINE matched itself"); }
25 //~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
26 //~| WARN will become a hard error in a future release
27 _
=> { println!("WRAP_INDIRECT_INLINE did not match itself"); }