Closed leonardo-m closed 7 years ago
This little program:
#![feature(conservative_impl_trait)] fn suffixes(txt: &str) -> impl Iterator<Item=&str> { txt.char_indices().skip(1).map(|&(j, _)| &txt[j ..]) } fn main() {}
Generates:
error: internal compiler error: src\librustc_typeck\check\mod.rs:617: escaping regions in predicate Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { trait_ref: <_ as std::iter::Iterator>, item_def_id: DefId { krate: CrateNum(2), node: DefIndex(1577) => core/a635d0d::iter[0]::iterator[0]::Iterator[0]::Item[0] } }, &str)),depth=0) --> test.rs:3:27 | 3 | fn suffixes(txt: &str) -> impl Iterator<Item=&str> { | ^^^^^^^^^^^^^^^^^^^^^^^^ note: the compiler unexpectedly panicked. this is a bug. note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports note: rustc 1.20.0-nightly (2fbba5bdb 2017-07-04) running on x86_64-pc-windows-gnu
Duplicate of #43021 or #42479.
Closing as duplicate.
This little program:
Generates: