]> git.lizzy.rs Git - rust.git/blob - src/test/ui/derives/issue-91550.rs
Rollup merge of #105955 - Nilstrieb:no-trivial-opt-wrappers-we-have-field-accesses...
[rust.git] / src / test / ui / derives / issue-91550.rs
1 use std::collections::HashSet;
2
3 /// natural case from the issue
4 struct Value(u32);
5
6 fn main() {
7     let hs = HashSet::<Value>::new();
8     hs.insert(Value(0)); //~ ERROR
9 }
10
11 /// synthetic cases
12 pub struct NoDerives;
13
14 struct Object<T>(T);
15 impl<T: Eq> Object<T> {
16     fn use_eq(&self) {}
17 }
18 impl<T: Ord> Object<T> {
19     fn use_ord(&self) {}
20 }
21 impl<T: Ord + PartialOrd> Object<T> {
22     fn use_ord_and_partial_ord(&self) {}
23 }
24
25 fn function(foo: Object<NoDerives>) {
26     foo.use_eq(); //~ ERROR
27     foo.use_ord(); //~ ERROR
28     foo.use_ord_and_partial_ord(); //~ ERROR
29 }