]> git.lizzy.rs Git - rust.git/blob - tests/ui/crashes/ice-2774.rs
Merge pull request #3922 from rust-lang/run-pass
[rust.git] / tests / ui / crashes / ice-2774.rs
1 // run-pass
2
3 use std::collections::HashSet;
4
5 // See rust-lang/rust-clippy#2774.
6
7 #[derive(Eq, PartialEq, Debug, Hash)]
8 pub struct Bar {
9     foo: Foo,
10 }
11
12 #[derive(Eq, PartialEq, Debug, Hash)]
13 pub struct Foo {}
14
15 #[allow(clippy::implicit_hasher)]
16 // This should not cause a "cannot relate bound region" ICE.
17 pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) {
18     let mut foos = HashSet::new();
19     foos.extend(bars.iter().map(|b| &b.foo));
20 }
21
22 #[allow(clippy::implicit_hasher)]
23 // Also, this should not cause a "cannot relate bound region" ICE.
24 pub fn add_barfoos_to_foos2(bars: &HashSet<&Bar>) {
25     let mut foos = HashSet::new();
26     foos.extend(bars.iter().map(|b| &b.foo));
27 }
28
29 fn main() {}