2016-03-25 09:02:56 -05:00
|
|
|
#[derive(Eq)]
|
|
|
|
struct Foo {
|
|
|
|
x: u32
|
|
|
|
}
|
|
|
|
|
|
|
|
impl PartialEq for Foo {
|
|
|
|
fn eq(&self, _: &Foo) -> bool {
|
2022-12-05 02:42:36 -06:00
|
|
|
false // ha ha!
|
2016-03-25 09:02:56 -05: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)]`
|
|
|
|
_ => { }
|
|
|
|
}
|
|
|
|
}
|