Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2833 from phansch/cannot_relate_bound_region_with…
…out_ICE_cream Fix cargo late bound region mismatch ICE
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use std::collections::HashSet; | ||
|
||
// See https://github.com/rust-lang-nursery/rust-clippy/issues/2774 | ||
|
||
#[derive(Eq, PartialEq, Debug, Hash)] | ||
pub struct Bar { | ||
foo: Foo, | ||
} | ||
|
||
#[derive(Eq, PartialEq, Debug, Hash)] | ||
pub struct Foo {} | ||
|
||
#[allow(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(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() {} |