2016-03-25 10:02:56 -04:00
|
|
|
#[derive(Eq)]
|
|
|
|
struct Foo {
|
|
|
|
x: u32
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PartialEq for Foo {
|
|
|
|
fn eq(&self, _: &Foo) -> bool {
|
2022-12-05 16:42:36 +08:00
|
|
|
false // ha ha!
|
2016-03-25 10:02:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const FOO: Foo = Foo { x: 0 };
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let y = Foo { x: 1 };
|
|
|
|
match y {
|
|
|
|
FOO => { }
|
|
|
|
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
|
|
|
|
_ => { }
|
|
|
|
}
|
|
|
|
}
|