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 misused conservative impl trait #44063

Closed
leonardo-m opened this issue Aug 23, 2017 · 1 comment
Closed

ICE with misused conservative impl trait #44063

leonardo-m opened this issue Aug 23, 2017 · 1 comment

Comments

@leonardo-m
Copy link

This is wrong code:

#![feature(conservative_impl_trait)]
fn foo(filename: &str) -> impl Iterator<Item=&str> {
    use std::fs::File;
    use std::io::{BufReader, BufRead};
    BufReader::new(File::open(filename).unwrap()).lines()
}
fn main() {}

The compiler gives:

error: internal compiler error: src\librustc_typeck\check\mod.rs:626: escaping regions in predicate Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { substs: Slice([_]), item_def_id: DefId { krate: CrateNum(2), node: DefIndex(1588) => core/571a388::iter[0]::iterator[0]::Iterator[0]::Item[0] } }, &str)),depth=0)
 --> ...\test.rs:2:27
  |
2 | fn foo(filename: &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.21.0-nightly (469a6f9bd 2017-08-22) running on x86_64-pc-windows-gnu

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:436:8
stack backtrace:
   0: mingw_set_invalid_parameter_handler
...

@kennytm
Copy link
Member

kennytm commented Aug 23, 2017

Duplicate of #42479...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants