New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE with impl_trait #43073

Closed
leonardo-m opened this Issue Jul 5, 2017 · 2 comments

Comments

Projects
None yet
4 participants
@leonardo-m
Copy link

leonardo-m commented Jul 5, 2017

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
@kennytm

This comment has been minimized.

Copy link
Member

kennytm commented Jul 5, 2017

Duplicate of #43021 or #42479.

@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Nov 26, 2017

Closing as duplicate.

@arielb1 arielb1 closed this Nov 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment