Skip to content

Compiler panic with "broken MIR in Item(WithOptConstParam { .. })" #87771

Closed

Description

Code

fn main() {
    let mut arr = vec![vec![]];
    arr[0][0] = arr[0][0] = true;
}

Meta

Results in an ICE on both the latest nightly and stable versions:

rustc 1.56.0-nightly (a6ece5615 2021-08-03)
binary: rustc
commit-hash: a6ece56152d8eb11e049e9fcce147b2859e12c92
commit-date: 2021-08-03
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1

rustc 1.54.0 (a178d0322 2021-07-26)
binary: rustc
commit-hash: a178d0322ce20e33eac124758e837cbd80a6f633
commit-date: 2021-07-26
host: x86_64-unknown-linux-gnu
release: 1.54.0
LLVM version: 12.0.1

Error output

   Compiling play v0.1.0 (/tmp/play)
warning: Error finalizing incremental compilation session directory `/tmp/play/target/debug/incremental/play-26d7ofbz97wss/s-g141ls6r72-s5ddqo-working`: No such file or directory (os error 2)

error: internal compiler error[E0308]: mismatched types
 --> src/main.rs:3:17
  |
3 |     arr[0][0] = arr[0][1] = true;
  |                 ^^^^^^^^^^^^^^^^ expected `bool`, found `()`

error: internal compiler error: broken MIR in DefId(0:3 ~ play[8f25]::main) ((*_10) = const ()): bad assignment (bool = ()): NoSolution
 --> src/main.rs:3:5
  |
3 |     arr[0][0] = arr[0][1] = true;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:299:27

error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ play[8f25]::main), const_param_did: None }) (end of phase Optimization) at bb6[0]:
encountered `Assign(((*_10), const ()))` with incompatible types:
left-hand side has type: bool
right-hand side has type: ()
 --> src/main.rs:3:5
  |
3 |     arr[0][0] = arr[0][1] = true;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: delayed at compiler/rustc_mir/src/transform/validate.rs:121:36

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1050:13
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.56.0-nightly (a6ece5615 2021-08-03) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
warning: `play` (bin "play") generated 1 warning
error: could not compile `play`; 1 warning emitted
Backtrace

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1050:13
stack backtrace:
   0:     0x7f3eb028b6e0 - std::backtrace_rs::backtrace::libunwind::trace::h820df6e5a36600f2
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7f3eb028b6e0 - std::backtrace_rs::backtrace::trace_unsynchronized::h08422e102b839b36
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f3eb028b6e0 - std::sys_common::backtrace::_print_fmt::h57fa141da5c1d78f
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f3eb028b6e0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he771973a791a4e00
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7f3eb02f97bc - core::fmt::write::h9a6d9c74526a6c1b
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/core/src/fmt/mod.rs:1117:17
   5:     0x7f3eb027cf25 - std::io::Write::write_fmt::h9d3df603db3c3ca4
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/io/mod.rs:1667:15
   6:     0x7f3eb028ed2b - std::sys_common::backtrace::_print::ha158db1ea88125c4
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7f3eb028ed2b - std::sys_common::backtrace::print::h342dde07e263fe00
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7f3eb028ed2b - std::panicking::default_hook::{{closure}}::h642e95a669718f6e
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/panicking.rs:208:50
   9:     0x7f3eb028e8a0 - std::panicking::default_hook::hc5055134d92c4284
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/panicking.rs:225:9
  10:     0x7f3eb0a6dd51 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::haff05a7eace0faae
  11:     0x7f3eb028f559 - std::panicking::rust_panic_with_hook::h6f45f3f96085621d
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/panicking.rs:627:17
  12:     0x7f3eb028f017 - std::panicking::begin_panic_handler::{{closure}}::h8cc693a35602cb15
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/panicking.rs:520:13
  13:     0x7f3eb028bbcc - std::sys_common::backtrace::__rust_end_short_backtrace::h89bf48eb2468d1e3
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7f3eb028ef79 - rust_begin_unwind
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/panicking.rs:516:5
  15:     0x7f3eb02585cb - std::panicking::begin_panic_fmt::h7b704e109b8f89ba
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/panicking.rs:458:5
  16:     0x7f3eb2ec7a49 - rustc_errors::HandlerInner::flush_delayed::h1214dd69c94464a0
  17:     0x7f3eb2ec64ad - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h99b093f7064b7696
  18:     0x7f3eb257c886 - core::ptr::drop_in_place<rustc_session::parse::ParseSess>::hf782bb3707a77e2d
  19:     0x7f3eb257e5fe - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h30c9788e90bfa607
  20:     0x7f3eb2552a6d - core::ptr::drop_in_place<rustc_interface::interface::Compiler>::h04cee182ac6141b7
  21:     0x7f3eb25521b3 - rustc_span::with_source_map::h8044517cb42f9e14
  22:     0x7f3eb2563f3a - rustc_interface::interface::create_compiler_and_run::h600b31664ea7498c
  23:     0x7f3eb2556099 - scoped_tls::ScopedKey<T>::set::h67b78cee48afc23b
  24:     0x7f3eb25525aa - std::sys_common::backtrace::__rust_begin_short_backtrace::h7d4575ab5f030af1
  25:     0x7f3eb25518e5 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h0e7f7efed8d1ac6c
  26:     0x7f3eb029c1c7 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he2a466339cf4c9af
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/alloc/src/boxed.rs:1572:9
  27:     0x7f3eb029c1c7 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1f2d848478877ebe
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/alloc/src/boxed.rs:1572:9
  28:     0x7f3eb029c1c7 - std::sys::unix::thread::Thread::new::thread_start::h12773e412063ea14
                               at /rustc/a6ece56152d8eb11e049e9fcce147b2859e12c92/library/std/src/sys/unix/thread.rs:91:17
  29:     0x7f3eb01b5eae - start_thread
                               at /builddir/glibc-2.32/nptl/pthread_create.c:463:8
  30:     0x7f3eb00d42ff - __GI___clone
                               at /builddir/glibc-2.32/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95
  31:                0x0 - <unknown>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions