Closed
Description
use std::io::{BufRead, BufReader};
use std::fs::File;
fn file_lines() -> impl Iterator<Item=String> {
BufReader::new(File::open("data.txt").unwrap()).lines().map(Result::unwrap)
}
fn main() {
for _ in file_lines() {}
}
Compiling with rustc -Z mir-opt-level=2 test.rs
I get since two nightlies:
error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<impl std::iter::Iterator as std::iter::Iterator>)` during codegen
|
= note: delayed at compiler\rustc_trait_selection\src\traits\codegen\mod.rs:65:32
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler\rustc_errors\src\lib.rs:961:13
stack backtrace:
0: rust_begin_unwind
at /rustc/c71248b70870960af9993de4f31d3cba9bbce7e8\/library\std\src/panicking.rs:483:5
1: std::panicking::begin_panic_fmt
at /rustc/c71248b70870960af9993de4f31d3cba9bbce7e8\/library\std\src/panicking.rs:437:5
2: rustc_errors::HandlerInner::flush_delayed
3: <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop
4: core::ptr::drop_in_place
5: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
6: core::ptr::drop_in_place
7: rustc_span::with_source_map
8: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.49.0-nightly (c71248b70 2020-10-11) running on x86_64-pc-windows-gnu
note: compiler flags: -Z mir-opt-level=2
query stack during panic:
end of query stack
Metadata
Metadata
Assignees
Labels
Area: MIR optimizationsCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.