Skip to content

Commit c6999a5

Browse files
authored
Rollup merge of #64706 - nikomatsakis:issue-60218-test-case, r=centril
add regression test for #60218 Fixes #60218
2 parents 2a9bd75 + 4396a1c commit c6999a5

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

src/test/ui/issues/issue-60218.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Regression test for #60218
2+
//
3+
// This was reported to cause ICEs.
4+
5+
use std::iter::Map;
6+
7+
pub trait Foo {}
8+
9+
pub fn trigger_error<I, F>(iterable: I, functor: F)
10+
where
11+
for<'t> &'t I: IntoIterator,
12+
for<'t> Map<<&'t I as IntoIterator>::IntoIter, F>: Iterator,
13+
for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo,
14+
{
15+
}
16+
17+
fn main() {
18+
trigger_error(vec![], |x: &u32| x) //~ ERROR E0277
19+
}

src/test/ui/issues/issue-60218.stderr

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0277]: the trait bound `for<'t> <std::iter::Map<<&'t _ as std::iter::IntoIterator>::IntoIter, _> as std::iter::Iterator>::Item: Foo` is not satisfied
2+
--> $DIR/issue-60218.rs:18:5
3+
|
4+
LL | pub fn trigger_error<I, F>(iterable: I, functor: F)
5+
| -------------
6+
...
7+
LL | for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo,
8+
| --- required by this bound in `trigger_error`
9+
...
10+
LL | trigger_error(vec![], |x: &u32| x)
11+
| ^^^^^^^^^^^^^ the trait `for<'t> Foo` is not implemented for `<std::iter::Map<<&'t _ as std::iter::IntoIterator>::IntoIter, _> as std::iter::Iterator>::Item`
12+
13+
error: aborting due to previous error
14+
15+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)