Closed
Description
This compiles with no errors:
#![feature(conservative_impl_trait, in_band_lifetimes, underscore_lifetimes)]
fn foo<T>(items: &'a [T]) -> impl Iterator<Item=(&'a T, &'a T)> + 'a {
items
.iter()
.enumerate()
.flat_map(move |(i, x1)| items[i ..].iter().map(move |x2| (x1, x2)))
}
fn main() {}
If I replace 'a with '_:
#![feature(conservative_impl_trait, underscore_lifetimes)]
fn foo<T>(items: &'_ [T]) -> impl Iterator<Item=(&'_ T, &'_ T)> + '_ {
items
.iter()
.enumerate()
.flat_map(move |(i, x1)| items[i ..].iter().map(move |x2| (x1, x2)))
}
fn main() {}
The last Nightly ICEs:
error: internal compiler error: src\librustc_typeck\check\mod.rs:671: escaping regions in predicate Obligation(predicate=Binder(OutlivesPredicate(_, ReLateBound(DebruijnIndex { depth: 3 }, BrAnon(0)))),depth=0)
--> ...\test.rs:2:30
|
2 | fn foo<T>(items: &'_ [T]) -> impl Iterator<Item=(&'_ T, &'_ T)> + '_ {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: rustc 1.24.0-nightly (f9b0897c5 2017-12-02) running on x86_64-pc-windows-gnu
thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:448:8
stack backtrace:
0: mingw_set_invalid_parameter_handler
...