1 // Test explores how `#[structral_match]` behaves in tandem with
2 // `*const` and `*mut` pointers.
6 #![warn(pointer_structural_match)]
10 // This impl makes NoDerive irreflexive
11 // (which doesn't matter here because `<*const T>::eq` won't recur on `T`).
12 impl PartialEq
for NoDerive { fn eq(&self, _: &Self) -> bool { false }
}
14 impl Eq
for NoDerive { }
16 #[derive(PartialEq, Eq)]
17 struct WrapParam
<X
>(*const X
);
19 const WRAP_UNSAFE_PARAM
: & &WrapParam
<NoDerive
> = & &WrapParam(std
::ptr
::null());
22 match WRAP_UNSAFE_PARAM
{
23 WRAP_UNSAFE_PARAM
=> { println!("WRAP_UNSAFE_PARAM correctly matched itself"); }
24 _
=> { panic!("WRAP_UNSAFE_PARAM did not match itself"); }