Skip to content

ICE: do not use optimized_mir for constants: Const with -Zunpretty=mir-cfg #82326

Closed
@matthiaskrgr

Description

@matthiaskrgr

code from glacier fixed/21073.rs

Code

const TAG: &'static [u8] = b"ABCD";

fn main() {
    match &[][..] {
        TAG => println!("Yes."),
        _ => println!("No."),
    }
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (9b471a3f5 2021-02-19)
binary: rustc
commit-hash: 9b471a3f5fe57e5c6e08acf665f2094422415a3d
commit-date: 2021-02-19
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1

Error output

rustc ./21073.rs -Zunpretty=mir-cfg

thread 'rustc' panicked at 'do not use `optimized_mir` for constants: Const', compiler/rustc_mir/src/transform/mod.rs:579:24
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.52.0-nightly (9b471a3f5 2021-02-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=mir-cfg

query stack during panic:
#0 [optimized_mir] optimizing MIR for `TAG`
end of query stack
Backtrace

thread 'rustc' panicked at 'do not use `optimized_mir` for constants: Const', compiler/rustc_mir/src/transform/mod.rs:579:24
stack backtrace:
   0:     0x7fb061c89ab0 - std::backtrace_rs::backtrace::libunwind::trace::hb4de9797f80b7b8c
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fb061c89ab0 - std::backtrace_rs::backtrace::trace_unsynchronized::h59566d0bd20efff7
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb061c89ab0 - std::sys_common::backtrace::_print_fmt::hcfa5ce6be50275d4
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fb061c89ab0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd8c307a38b9bab04
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fb061cfae6c - core::fmt::write::h3868db8542c90941
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/core/src/fmt/mod.rs:1092:17
   5:     0x7fb061c7c992 - std::io::Write::write_fmt::hab90295d5a0f197d
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/io/mod.rs:1568:15
   6:     0x7fb061c8d9a5 - std::sys_common::backtrace::_print::h19224910b8700cf1
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fb061c8d9a5 - std::sys_common::backtrace::print::h25dedfa68c5fb84a
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fb061c8d9a5 - std::panicking::default_hook::{{closure}}::h12c5765653a72a42
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:208:50
   9:     0x7fb061c8d453 - std::panicking::default_hook::he65cee71c4209f0c
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:225:9
  10:     0x7fb0624ec08b - rustc_driver::report_ice::h56d5f6e6a9fb9d03
  11:     0x7fb061c8e2a6 - std::panicking::rust_panic_with_hook::h01a674d863fe0d8a
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:595:17
  12:     0x7fb061c8ddc7 - std::panicking::begin_panic_handler::{{closure}}::h9b9fecf185178864
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:497:13
  13:     0x7fb061c89f4c - std::sys_common::backtrace::__rust_end_short_backtrace::h57be46a42dc7f24b
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7fb061c8dd29 - rust_begin_unwind
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:493:5
  15:     0x7fb061c8dcdb - std::panicking::begin_panic_fmt::h12277576db89392f
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/panicking.rs:435:5
  16:     0x7fb064eafe45 - rustc_mir::transform::optimized_mir::h245976003198d078
  17:     0x7fb0624b15a3 - rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::optimized_mir>::compute::h962929d1c2186a42
  18:     0x7fb0624e4754 - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl::h987bcc4d742b6eab
  19:     0x7fb0624e59ec - rustc_query_system::dep_graph::graph::DepGraph<K>::with_task::h640404db930a6fbb
  20:     0x7fb062509274 - rustc_data_structures::stack::ensure_sufficient_stack::hd389d807f70b11da
  21:     0x7fb0624b3a55 - rustc_query_system::query::plumbing::force_query_with_job::h4d36fcda7c0d6736
  22:     0x7fb0624b3060 - rustc_query_system::query::plumbing::get_query_impl::hff20e28a826798af
  23:     0x7fb0624b5ab1 - rustc_query_system::query::plumbing::get_query::h5f686cd74df0b95e
  24:     0x7fb0624fe9a2 - rustc_mir::util::graphviz::write_mir_graphviz::he12cbf8a95c30fe6
  25:     0x7fb0624a15e4 - rustc_driver::pretty::print_after_hir_lowering::h102b65afa3784540
  26:     0x7fb0624f363e - rustc_interface::passes::QueryContext::enter::he206c0d61f6fb2e9
  27:     0x7fb06485e6d7 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::hae97633c8f5175d4
  28:     0x7fb064856e11 - rustc_span::with_source_map::hd16d211d24c668a9
  29:     0x7fb06485dc62 - scoped_tls::ScopedKey<T>::set::h08e96579ac07fec5
  30:     0x7fb06485f448 - std::sys_common::backtrace::__rust_begin_short_backtrace::h84dc4b3263d56f8c
  31:     0x7fb06483daba - core::ops::function::FnOnce::call_once{{vtable.shim}}::h209d27a00dc0b7e3
  32:     0x7fb061c9effa - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h321523073ee11258
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/alloc/src/boxed.rs:1546:9
  33:     0x7fb061c9effa - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf0e85e12c83b99b3
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/alloc/src/boxed.rs:1546:9
  34:     0x7fb061c9effa - std::sys::unix::thread::Thread::new::thread_start::hba22c7961aa0e2f8
                               at /rustc/9b471a3f5fe57e5c6e08acf665f2094422415a3d/library/std/src/sys/unix/thread.rs:71:17
  35:     0x7fb061ba4299 - start_thread
  36:     0x7fb061ab9153 - clone
  37:                0x0 - <unknown>

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.52.0-nightly (9b471a3f5 2021-02-19) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z unpretty=mir-cfg

query stack during panic:
#0 [optimized_mir] optimizing MIR for `TAG`
end of query stack

Metadata

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.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions