add regression test for #60218

This commit is contained in:
Niko Matsakis 2019-09-20 16:54:27 -04:00
parent 2daa404e9a
commit 4396a1ccd4
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,19 @@
// Regression test for #60218
//
// This was reported to cause ICEs.
use std::iter::Map;
pub trait Foo {}
pub fn trigger_error<I, F>(iterable: I, functor: F)
where
for<'t> &'t I: IntoIterator,
for<'t> Map<<&'t I as IntoIterator>::IntoIter, F>: Iterator,
for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo,
{
}
fn main() {
trigger_error(vec![], |x: &u32| x) //~ ERROR E0277
}

View File

@ -0,0 +1,15 @@
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
--> $DIR/issue-60218.rs:18:5
|
LL | pub fn trigger_error<I, F>(iterable: I, functor: F)
| -------------
...
LL | for<'t> <Map<<&'t I as IntoIterator>::IntoIter, F> as Iterator>::Item: Foo,
| --- required by this bound in `trigger_error`
...
LL | trigger_error(vec![], |x: &u32| x)
| ^^^^^^^^^^^^^ the trait `for<'t> Foo` is not implemented for `<std::iter::Map<<&'t _ as std::iter::IntoIterator>::IntoIter, _> as std::iter::Iterator>::Item`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.