]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/crashes/ice-2774.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / crashes / ice-2774.rs
CommitLineData
72b1a166
FG
1use std::collections::HashSet;
2
3// See rust-lang/rust-clippy#2774.
4
5#[derive(Eq, PartialEq, Debug, Hash)]
6pub struct Bar {
7 foo: Foo,
8}
9
10#[derive(Eq, PartialEq, Debug, Hash)]
11pub struct Foo {}
12
13#[allow(clippy::implicit_hasher)]
14// This should not cause a "cannot relate bound region" ICE.
15pub 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.
22pub 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
27fn main() {}