]>
Commit | Line | Data |
---|---|---|
72b1a166 FG |
1 | use std::collections::HashSet; |
2 | ||
3 | // See rust-lang/rust-clippy#2774. | |
4 | ||
5 | #[derive(Eq, PartialEq, Debug, Hash)] | |
6 | pub struct Bar { | |
7 | foo: Foo, | |
8 | } | |
9 | ||
10 | #[derive(Eq, PartialEq, Debug, Hash)] | |
11 | pub struct Foo {} | |
12 | ||
13 | #[allow(clippy::implicit_hasher)] | |
14 | // This should not cause a "cannot relate bound region" ICE. | |
15 | pub fn add_barfoos_to_foos<'a>(bars: &HashSet<&'a Bar>) { | |
16 | let mut foos = HashSet::new(); | |
17 | foos.extend(bars.iter().map(|b| &b.foo)); | |
18 | } | |
19 | ||
20 | #[allow(clippy::implicit_hasher)] | |
21 | // Also, this should not cause a "cannot relate bound region" ICE. | |
22 | pub fn add_barfoos_to_foos2(bars: &HashSet<&Bar>) { | |
23 | let mut foos = HashSet::new(); | |
24 | foos.extend(bars.iter().map(|b| &b.foo)); | |
25 | } | |
26 | ||
27 | fn main() {} |