]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/eq-multidispatch.rs
Rollup merge of #61499 - varkor:issue-53457, r=oli-obk
[rust.git] / src / test / run-pass / eq-multidispatch.rs
1 #[derive(PartialEq, Debug)]
2 struct Bar;
3 #[derive(Debug)]
4 struct Baz;
5 #[derive(Debug)]
6 struct Foo;
7 #[derive(Debug)]
8 struct Fu;
9
10 impl PartialEq for Baz { fn eq(&self, _: &Baz) -> bool  { true } }
11
12 impl PartialEq<Fu> for Foo { fn eq(&self, _: &Fu) -> bool { true } }
13 impl PartialEq<Foo> for Fu { fn eq(&self, _: &Foo) -> bool { true } }
14
15 impl PartialEq<Bar> for Foo { fn eq(&self, _: &Bar) -> bool { false } }
16 impl PartialEq<Foo> for Bar { fn eq(&self, _: &Foo) -> bool { false } }
17
18 fn main() {
19     assert!(Bar != Foo);
20     assert!(Foo != Bar);
21
22     assert_eq!(Bar, Bar);
23
24     assert_eq!(Baz, Baz);
25
26     assert_eq!(Foo, Fu);
27     assert_eq!(Fu, Foo);
28 }