Skip to content
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
Closed

ICE with impl_trait #43073

leonardo-m opened this issue Jul 5, 2017 · 2 comments
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@leonardo-m
Copy link

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
Copy link
Member

kennytm commented Jul 5, 2017

Duplicate of #43021 or #42479.

@Mark-Simulacrum Mark-Simulacrum added A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jul 6, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 22, 2017
@arielb1
Copy link
Contributor

arielb1 commented Nov 26, 2017

Closing as duplicate.

@arielb1 arielb1 closed this as completed Nov 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants