Closed
Description
Command: rustc src/test/ui/consts/ice-zst-static-access.rs --emit mir
Code
This code is from src/test/ui/consts/ice-zst-static-access.rs
// check-pass
// This is a regression test for ICEs from
// https://github.com/rust-lang/rust/issues/71612
// and
// https://github.com/rust-lang/rust/issues/71709
#[derive(Copy, Clone)]
pub struct Glfw;
static mut GLFW: Option<Glfw> = None;
pub fn new() -> Glfw {
unsafe {
if let Some(glfw) = GLFW {
return glfw;
} else {
todo!()
}
};
}
extern "C" {
static _dispatch_queue_attr_concurrent: [u8; 0];
}
static DISPATCH_QUEUE_CONCURRENT: &'static [u8; 0] =
unsafe { &_dispatch_queue_attr_concurrent };
fn main() {
*DISPATCH_QUEUE_CONCURRENT;
new();
}
Meta
rustc --version --verbose
:
The compiler is at revision aeb4738
rustc 1.45.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.45.0-dev
LLVM version: 9.0
Error output
warning: unused unary operation that must be used
--> ./ui/consts/ice-zst-static-access.rs:30:5
|
30 | *DISPATCH_QUEUE_CONCURRENT;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
error: internal compiler error: src/librustc_middle/mir/interpret/mod.rs:389: expected memory, got Static(DefId(0:6 ~ ice_zst_static_access[317d]::[0]::_dispatch_queue_attr_concurrent[0]))
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
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: rustc 1.45.0-dev running on x86_64-unknown-linux-gnu
error: aborting due to previous error; 1 warning emitted
Backtrace
warning: unused unary operation that must be used
--> ./ui/consts/ice-zst-static-access.rs:30:5
|
30 | *DISPATCH_QUEUE_CONCURRENT;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
error: internal compiler error: src/librustc_middle/mir/interpret/mod.rs:389: expected memory, got Static(DefId(0:6 ~ ice_zst_static_access[317d]::[0]::_dispatch_queue_attr_concurrent[0]))
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907:9
stack backtrace:
0: 0x7fee57224089 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd08e85f94cff0dfc
1: 0x7fee5726eadc - core::fmt::write::h65255e7874586eb2
2: 0x7fee572115a0 - std::io::Write::write_fmt::h3426e27a15389754
3: 0x7fee571feb25 - std::panicking::default_hook::{{closure}}::hf30497d1f1ca597f
4: 0x7fee571fe80f - std::panicking::default_hook::h9e9a0711680f7c71
5: 0x7fee589fcd83 - rustc_driver::report_ice::h5ae862a314f73c0a
6: 0x7fee571ff21d - std::panicking::rust_panic_with_hook::hf9e06a37c137122b
7: 0x7fee5ca83563 - std::panicking::begin_panic::h33636113330b48aa
8: 0x7fee5cabda80 - rustc_errors::HandlerInner::bug::h52d7e1cb0240ea9a
9: 0x7fee5cabc310 - rustc_errors::Handler::bug::hb9179f645d9eebfc
10: 0x7fee5c5c99bd - rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}::ha2320eff725974f0
11: 0x7fee5c5ba015 - rustc_middle::ty::context::tls::with_opt::{{closure}}::ha5fdac267ed6d665
12: 0x7fee5c5b9f7e - rustc_middle::ty::context::tls::with_opt::h5a46bd0f8944e3da
13: 0x7fee5c5c98c5 - rustc_middle::util::bug::opt_span_bug_fmt::hca9e39ad66e1e817
14: 0x7fee5c5c9830 - rustc_middle::util::bug::bug_fmt::h12c26b5ba6d149ef
15: 0x7fee5c2fb158 - rustc_middle::ty::print::pretty::PrettyPrinter::pretty_print_const::h817e42958e0f08aa
16: 0x7fee5c3eff8c - rustc_middle::mir::pretty_print_const::h3e9268740a5abca3
17: 0x7fee5726eadc - core::fmt::write::h65255e7874586eb2
18: 0x7fee5726ff72 - <core::fmt::Formatter as core::fmt::Write>::write_fmt::h4391506298bd83e2
19: 0x7fee5c717774 - <&T as core::fmt::Debug>::fmt::h57a5131d265df8f0
20: 0x7fee5726eadc - core::fmt::write::h65255e7874586eb2
21: 0x7fee5726ff72 - <core::fmt::Formatter as core::fmt::Write>::write_fmt::h4391506298bd83e2
22: 0x7fee5c3ed5c8 - <rustc_middle::mir::Operand as core::fmt::Debug>::fmt::hb676f8b47d6c04be
23: 0x7fee5726eadc - core::fmt::write::h65255e7874586eb2
24: 0x7fee5726ff72 - <core::fmt::Formatter as core::fmt::Write>::write_fmt::h4391506298bd83e2
25: 0x7fee5c3edc2b - <rustc_middle::mir::Rvalue as core::fmt::Debug>::fmt::h08da1cab9d3f68fd
26: 0x7fee5726eadc - core::fmt::write::h65255e7874586eb2
27: 0x7fee5726ff72 - <core::fmt::Formatter as core::fmt::Write>::write_fmt::h4391506298bd83e2
28: 0x7fee5c3ecf37 - <rustc_middle::mir::Statement as core::fmt::Debug>::fmt::h36848a833a8ff140
29: 0x7fee5726ea4c - core::fmt::write::h65255e7874586eb2
30: 0x7fee5724d903 - alloc::fmt::format::h133900b0fc9df957
31: 0x7fee5b2d700a - rustc_mir::util::pretty::write_mir_pretty::hb3aac4600eda79f5
32: 0x7fee5b5317d1 - rustc_mir::transform::dump_mir::emit_mir::h1bd5e01ce1a125e0
33: 0x7fee58dadff3 - rustc_interface::passes::start_codegen::h57d97e26628aab71
34: 0x7fee58c976f0 - rustc_middle::ty::context::tls::enter_global::h5b0209aac3b02988
35: 0x7fee58cb1ac6 - rustc_interface::queries::Queries::ongoing_codegen::h6cad2d99c2dcd590
36: 0x7fee589ca1b1 - rustc_interface::interface::run_compiler_in_existing_thread_pool::h9998dbf493c360fb
37: 0x7fee58a0a08e - scoped_tls::ScopedKey<T>::set::h429ea38eed219381
38: 0x7fee58a03494 - rustc_ast::attr::with_globals::h520bb7fad596003b
39: 0x7fee58a1214f - std::sys_common::backtrace::__rust_begin_short_backtrace::h66a2db9ac00d8f49
40: 0x7fee58b58a5e - core::ops::function::FnOnce::call_once{{vtable.shim}}::hed3e3cb32357dea8
41: 0x7fee571ffb38 - std::sys::unix::thread::Thread::new::thread_start::h294f0533d573419f
42: 0x7fee56f2d46f - start_thread
43: 0x7fee5704a3d3 - clone
44: 0x0 - <unknown>
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: rustc 1.45.0-dev running on x86_64-unknown-linux-gnu
query stack during panic:
end of query stack
error: aborting due to previous error; 1 warning emitted
Metadata
Metadata
Assignees
Labels
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlArea: Pretty printing (including `-Z unpretty`)Category: This is a bug.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.