]> git.lizzy.rs Git - rust.git/blob - tests/ui/derive_hash_xor_eq.rs
Auto merge of #68717 - petrochenkov:stabexpat, r=varkor
[rust.git] / tests / ui / derive_hash_xor_eq.rs
1 #[derive(PartialEq, Hash)]
2 struct Foo;
3
4 impl PartialEq<u64> for Foo {
5     fn eq(&self, _: &u64) -> bool {
6         true
7     }
8 }
9
10 #[derive(Hash)]
11 struct Bar;
12
13 impl PartialEq for Bar {
14     fn eq(&self, _: &Bar) -> bool {
15         true
16     }
17 }
18
19 #[derive(Hash)]
20 struct Baz;
21
22 impl PartialEq<Baz> for Baz {
23     fn eq(&self, _: &Baz) -> bool {
24         true
25     }
26 }
27
28 #[derive(PartialEq)]
29 struct Bah;
30
31 impl std::hash::Hash for Bah {
32     fn hash<H: std::hash::Hasher>(&self, _: &mut H) {}
33 }
34
35 #[derive(PartialEq)]
36 struct Foo2;
37
38 trait Hash {}
39
40 // We don't want to lint on user-defined traits called `Hash`
41 impl Hash for Foo2 {}
42
43 mod use_hash {
44     use std::hash::{Hash, Hasher};
45
46     #[derive(PartialEq)]
47     struct Foo3;
48
49     impl Hash for Foo3 {
50         fn hash<H: std::hash::Hasher>(&self, _: &mut H) {}
51     }
52 }
53
54 fn main() {}