diff options
Diffstat (limited to 'src/test/ui/derives/issue-91550.rs')
-rw-r--r-- | src/test/ui/derives/issue-91550.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/derives/issue-91550.rs b/src/test/ui/derives/issue-91550.rs new file mode 100644 index 000000000..56fd5ffa8 --- /dev/null +++ b/src/test/ui/derives/issue-91550.rs @@ -0,0 +1,29 @@ +use std::collections::HashSet; + +/// natural case from the issue +struct Value(u32); + +fn main() { + let hs = HashSet::<Value>::new(); + hs.insert(Value(0)); //~ ERROR +} + +/// synthetic cases +pub struct NoDerives; + +struct Object<T>(T); +impl<T: Eq> Object<T> { + fn use_eq(&self) {} +} +impl<T: Ord> Object<T> { + fn use_ord(&self) {} +} +impl<T: Ord + PartialOrd> Object<T> { + fn use_ord_and_partial_ord(&self) {} +} + +fn function(foo: Object<NoDerives>) { + foo.use_eq(); //~ ERROR + foo.use_ord(); //~ ERROR + foo.use_ord_and_partial_ord(); //~ ERROR +} |