ICE: broken mir with -Zunsound-mir-opts: simplify arm identity #78628
Closed
Description
opened on Nov 1, 2020
Code
from ./src/test/ui/mir/issue-77359-simplify-arm-identity.rs
// run-pass
#![allow(dead_code)]
#[derive(Debug)]
enum MyEnum {
Variant2,
Variant3,
}
fn f(arg3: bool) -> MyStruct {
match if arg3 { Some(MyEnum::Variant3) } else { None } {
Some(t) => {
let ah = t;
return MyStruct(Some(ah));
}
_ => MyStruct(None)
}
}
#[derive(Debug)]
struct MyStruct(Option<MyEnum>);
fn main() {
f(true);
}
Meta
rustc --version --verbose
:
rustc 1.49.0-nightly (1d5b7c3c9 2020-11-01)
binary: rustc
commit-hash: 1d5b7c3c96a86c96f1fbf1441475028df94d165a
commit-date: 2020-11-01
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
Error output
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ issue_77359_simplify_arm_identity[317d]::f), const_param_did: None }) (end of phase Optimization) at bb5[0]:
use of local _5, which has no storage here
--> ./src/test/ui/mir/issue-77359-simplify-arm-identity.rs:15:20
|
15 | return MyStruct(Some(ah));
| ^^^^^^^^
|
= note: delayed at compiler/rustc_mir/src/transform/validate.rs:171:36
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:958: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.49.0-nightly (1d5b7c3c9 2020-11-01) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z unsound-mir-opts
query stack during panic:
end of query stack
Backtrace
error: internal compiler error: broken MIR in Item(WithOptConstParam { did: DefId(0:3 ~ issue_77359_simplify_arm_identity[317d]::f), const_param_did: None }) (end of phase Optimization) at bb5[0]:
use of local _5, which has no storage here
--> ./src/test/ui/mir/issue-77359-simplify-arm-identity.rs:15:20
|
15 | return MyStruct(Some(ah));
| ^^^^^^^^
|
= note: delayed at compiler/rustc_mir/src/transform/validate.rs:171:36
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:958:13
stack backtrace:
0: 0x7ffaf14ba5f0 - std::backtrace_rs::backtrace::libunwind::trace::h448c56741b6011d3
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
1: 0x7ffaf14ba5f0 - std::backtrace_rs::backtrace::trace_unsynchronized::h2d26397c5720fdbb
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7ffaf14ba5f0 - std::sys_common::backtrace::_print_fmt::h720a2f61f75b9f58
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7ffaf14ba5f0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8d62bbfda6d5c836
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/sys_common/backtrace.rs:46:22
4: 0x7ffaf152a52c - core::fmt::write::h1857a60b204f1b6a
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/core/src/fmt/mod.rs:1078:17
5: 0x7ffaf14ac252 - std::io::Write::write_fmt::h16a9fe7680ac245c
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/io/mod.rs:1518:15
6: 0x7ffaf14bf5a5 - std::sys_common::backtrace::_print::h9ba51a6db618de7d
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/sys_common/backtrace.rs:49:5
7: 0x7ffaf14bf5a5 - std::sys_common::backtrace::print::h5f20e41c85e91716
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/sys_common/backtrace.rs:36:9
8: 0x7ffaf14bf5a5 - std::panicking::default_hook::{{closure}}::h5b7294ca19e8edab
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/panicking.rs:208:50
9: 0x7ffaf14bf248 - std::panicking::default_hook::hb3948d1f74b6ff4c
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/panicking.rs:227:9
10: 0x7ffaf1d8e158 - rustc_driver::report_ice::h1ddbc5609a6e1f37
11: 0x7ffaf14bfea6 - std::panicking::rust_panic_with_hook::h55d23fef0ad751bc
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/panicking.rs:597:17
12: 0x7ffaf14bf9c7 - std::panicking::begin_panic_handler::{{closure}}::h56ae74c6dea6e141
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/panicking.rs:499:13
13: 0x7ffaf14baa8c - std::sys_common::backtrace::__rust_end_short_backtrace::h3c4721f56689fae4
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/sys_common/backtrace.rs:141:18
14: 0x7ffaf14bf929 - rust_begin_unwind
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/panicking.rs:495:5
15: 0x7ffaf14bf8db - std::panicking::begin_panic_fmt::h447a9fe10c3ac155
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/panicking.rs:437:5
16: 0x7ffaf4dff1c1 - rustc_errors::HandlerInner::flush_delayed::hcdae04493e012a6e
17: 0x7ffaf4dfbb91 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h27a485c12bfd5a8a
18: 0x7ffaf1d9b606 - core::ptr::drop_in_place::hac2c86d61f6a657d
19: 0x7ffaf1da0796 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::h60c965ef9381f1d3
20: 0x7ffaf1d46b2d - core::ptr::drop_in_place::h11c56312c481deac
21: 0x7ffaf1d36a2c - rustc_span::with_source_map::h4e49cbd9a39d01b4
22: 0x7ffaf1da70c1 - scoped_tls::ScopedKey<T>::set::hca96dcfe1d32eebf
23: 0x7ffaf1daed75 - std::sys_common::backtrace::__rust_begin_short_backtrace::h21cfd4855c5058aa
24: 0x7ffaf1d17188 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h2df6ccf8e166462a
25: 0x7ffaf14ceeaa - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9e7afb7a0a438236
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/alloc/src/boxed.rs:1307:9
26: 0x7ffaf14ceeaa - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h70c646c4271337a1
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/alloc/src/boxed.rs:1307:9
27: 0x7ffaf14ceeaa - std::sys::unix::thread::Thread::new::thread_start::h35d2b8d36f210d02
at /rustc/1d5b7c3c96a86c96f1fbf1441475028df94d165a/library/std/src/sys/unix/thread.rs:89:17
28: 0x7ffaf13ca3e9 - start_thread
29: 0x7ffaf12e7293 - __GI___clone
30: 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.49.0-nightly (1d5b7c3c9 2020-11-01) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z unsound-mir-opts
query stack during panic:
end of query stack
Activity