]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-1445-restrict-constants-in-patterns/match-requires-both-partialeq-and-eq.rs
Rollup merge of #100396 - chenyukang:fix-100394, r=petrochenkov
[rust.git] / src / test / ui / rfc-1445-restrict-constants-in-patterns / match-requires-both-partialeq-and-eq.rs
1 #[derive(Eq)]
2 struct Foo {
3     x: u32
4 }
5
6 impl PartialEq for Foo {
7     fn eq(&self, _: &Foo) -> bool {
8         false // ha ha sucker!
9     }
10 }
11
12 const FOO: Foo = Foo { x: 0 };
13
14 fn main() {
15     let y = Foo { x: 1 };
16     match y {
17         FOO => { }
18         //~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
19         _ => { }
20     }
21 }