]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/crashes/ice-2774.rs
bump version to 1.80.1+dfsg1-1~bpo12+pve1
[rustc.git] / src / tools / clippy / tests / ui / crashes / ice-2774.rs
CommitLineData
f20569fa
XL
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)]
04454e1e 11pub struct Foo;
f20569fa
XL
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>) {
781aab86
FG
16 //~^ ERROR: the following explicit lifetimes could be elided: 'a
17 //~| NOTE: `-D clippy::needless-lifetimes` implied by `-D warnings`
f20569fa
XL
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.
24pub 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
29fn main() {}