Skip to content

[ICE] with mir-opt-level=2 in traits\codegen\mod.rs #77911

Closed

Description

@leonardo-m
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

Activity

  1. added
    A-mir-optArea: MIR optimizations
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Oct 13, 2020
  2. JohnTitor commented on Oct 19, 2020

    @JohnTitor
    Member

    Triage: It's now compiled fine with the latest nightly, I think it's fixed by #77306.

  3. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Oct 19, 2020
  4. leonardo-m commented on Oct 19, 2020

    @leonardo-m
    Author

    It works now, thank you.

  5. JohnTitor commented on Oct 19, 2020

    @JohnTitor
    Member

    This should be open until the test is added.

  6. added 2 commits that reference this issue on Oct 20, 2020
    81e15c3
    a8a424f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-mir-optArea: MIR optimizationsC-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions