summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/crashes/ice-2774.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/tests/ui/crashes/ice-2774.rs')
-rw-r--r--src/tools/clippy/tests/ui/crashes/ice-2774.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/crashes/ice-2774.rs b/src/tools/clippy/tests/ui/crashes/ice-2774.rs
new file mode 100644
index 000000000..88cfa1f92
--- /dev/null
+++ b/src/tools/clippy/tests/ui/crashes/ice-2774.rs
@@ -0,0 +1,27 @@
+use std::collections::HashSet;
+
+// See rust-lang/rust-clippy#2774.
+
+#[derive(Eq, PartialEq, Debug, Hash)]
+pub struct Bar {
+ foo: Foo,
+}
+
+#[derive(Eq, PartialEq, Debug, Hash)]
+pub struct Foo;
+
+#[allow(clippy::implicit_hasher)]
+// This should not cause a "cannot relate bound region" ICE.
+pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) {
+ let mut foos = HashSet::new();
+ foos.extend(bars.iter().map(|b| &b.foo));
+}
+
+#[allow(clippy::implicit_hasher)]
+// Also, this should not cause a "cannot relate bound region" ICE.
+pub fn add_barfoos_to_foos2(bars: &HashSet<&Bar>) {
+ let mut foos = HashSet::new();
+ foos.extend(bars.iter().map(|b| &b.foo));
+}
+
+fn main() {}