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

nightly only: internal compiler error: broken MIR (Terminator .. #41726

Closed
FauxFaux opened this issue May 3, 2017 · 0 comments
Closed

nightly only: internal compiler error: broken MIR (Terminator .. #41726

FauxFaux opened this issue May 3, 2017 · 0 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@FauxFaux
Copy link

FauxFaux commented May 3, 2017

This (probably incorrect) program causes nightly rustc to panic:

use std::collections::HashMap;
fn main() {
    let things: HashMap<String, Vec<String>> = HashMap::new();
    for src in things.keys() {
        things[src.as_str()].sort();
    }
}
% RUST_BACKTRACE=1 rustc ice.rs
error: internal compiler error: broken MIR (Terminator { source_info: SourceInfo { span: ice.rs:5:9: 5:29, scope: scope4 }, kind: _17 = const std::ops::Index::index(_18, _19) -> [return: bb11, unwind: bb3] }): bad arg #0 (&std::collections::HashMap<std::string::String, std::vec::Vec<std::string::String>> <- &mut std::collections::HashMap<std::string::String, std::vec::Vec<std::string::String>>): Mutability
 --> ice.rs:5:28
  |
5 |         things[src.as_str()].sort();
  |                            ^

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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:376
stack backtrace:
   0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace
             at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at /checkout/src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at /checkout/src/libstd/sys_common/backtrace.rs:60
             at /checkout/src/libstd/panicking.rs:355
   3: std::panicking::default_hook
             at /checkout/src/libstd/panicking.rs:365
   4: std::panicking::rust_panic_with_hook
             at /checkout/src/libstd/panicking.rs:549
   5: std::panicking::begin_panic
   6: rustc_errors::Handler::span_bug
   7: rustc_mir::transform::type_check::TypeChecker::check_terminator
   8: rustc::infer::InferCtxtBuilder::enter
   9: <rustc_mir::transform::type_check::TypeckMir as rustc::mir::transform::MirPass<'tcx>>::run_pass
  10: <T as rustc::mir::transform::MirMapPass<'tcx>>::run_pass
  11: rustc::mir::transform::Passes::run_passes
  12: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}::{{closure}}
  13: rustc_driver::driver::phase_3_run_analysis_passes::{{closure}}
  14: rustc_driver::driver::phase_3_run_analysis_passes
  15: rustc_driver::driver::compile_input
  16: rustc_driver::run_compiler
  17: std::panicking::try::do_call
  18: __rust_maybe_catch_panic
             at /checkout/src/libpanic_unwind/lib.rs:98
  19: <F as alloc::boxed::FnBox<A>>::call_box
  20: std::sys::imp::thread::Thread::new::thread_start
             at /checkout/src/liballoc/boxed.rs:658
             at /checkout/src/libstd/sys_common/thread.rs:21
             at /checkout/src/libstd/sys/unix/thread.rs:84
  21: start_thread
  22: __clone
% rustc --version --verbose
rustc 1.19.0-nightly (6a5fc9eec 2017-05-02)
binary: rustc
commit-hash: 6a5fc9eecec235312755e737fb5b984abe537f2e
commit-date: 2017-05-02
host: x86_64-unknown-linux-gnu
release: 1.19.0-nightly
LLVM version: 4.0

On the beta, instead you get:

error: cannot borrow immutable indexed content as mutable
 --> ice.rs:5:9
  |
5 |         things[src.as_str()].sort();
  |         ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable

error: aborting due to previous error

 rustc 1.18.0-beta.1 (4dce67253 2017-04-25)
@nagisa nagisa added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label May 3, 2017
arielb1 added a commit to arielb1/rust that referenced this issue May 8, 2017
Hopefully this is the last PR needed.

Fixes rust-lang#41726.
Fixes rust-lang#41742.
Fixes rust-lang#41774.
frewsxcv added a commit to frewsxcv/rust that referenced this issue May 9, 2017
try to fix lvalue ops for real

Hopefully this is the last PR needed.

Fixes rust-lang#41726.
Fixes rust-lang#41742.
Fixes rust-lang#41774.
nikomatsakis pushed a commit to nikomatsakis/rust that referenced this issue May 22, 2017
Hopefully this is the last PR needed.

Fixes rust-lang#41726.
Fixes rust-lang#41742.
Fixes rust-lang#41774.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

2 participants