Closed
Description
openedon Nov 28, 2019
PR #66282 introduced an ICE in the following code with -Z mir-opt-level=2
:
enum Src {
Foo(u8),
Bar,
}
enum Dst {
Foo(u8),
}
fn main() {
let e: Src = Src::Foo(0);
let _: Dst = match e {
Src::Foo(x) => Dst::Foo(x),
Src::Bar => Dst::Foo(0),
};
}
Compiler output
error: internal compiler error: src/librustc_codegen_ssa/mir/operand.rs:329: store_with_flags: invalid ScalarPair layout: TyLayout {
ty: Dst,
details: LayoutDetails {
variants: Single {
index: 0,
},
fields: Arbitrary {
offsets: [
Size {
raw: 0,
},
],
memory_index: [
0,
],
},
abi: Scalar(
Scalar {
value: Int(
I8,
false,
),
valid_range: 0..=255,
},
),
largest_niche: None,
align: AbiAndPrefAlign {
abi: Align {
pow2: 0,
},
pref: Align {
pow2: 3,
},
},
size: Size {
raw: 1,
},
},
}
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:892:9
stack backtrace:
0: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
1: core::fmt::write
2: std::io::Write::write_fmt
3: std::panicking::default_hook::{{closure}}
4: std::panicking::default_hook
5: rustc_driver::report_ice
6: std::panicking::rust_panic_with_hook
7: std::panicking::begin_panic
8: rustc_errors::HandlerInner::bug
9: rustc_errors::Handler::bug
10: rustc::util::bug::opt_span_bug_fmt::{{closure}}
11: rustc::ty::context::tls::with_opt::{{closure}}
12: rustc::ty::context::tls::with_opt
13: rustc::util::bug::opt_span_bug_fmt
14: rustc::util::bug::bug_fmt
15: rustc_codegen_ssa::mir::operand::OperandValue<V>::store_with_flags
16: rustc_codegen_ssa::mir::rvalue::<impl rustc_codegen_ssa::mir::FunctionCx<Bx>>::codegen_rvalue
17: rustc_codegen_ssa::mir::codegen_mir
18: rustc_codegen_ssa::base::codegen_instance
19: <rustc::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define
20: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
21: rustc::dep_graph::graph::DepGraph::with_task
22: rustc_codegen_llvm::base::compile_codegen_unit
23: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
24: rustc_interface::passes::start_codegen::{{closure}}
25: rustc_interface::passes::start_codegen
26: rustc::ty::context::tls::enter_global
27: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
28: rustc_interface::passes::create_global_ctxt::{{closure}}
29: rustc_interface::passes::BoxedGlobalCtxt::enter
30: rustc_interface::queries::Query<T>::compute
31: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::ongoing_codegen
32: rustc_interface::interface::run_compiler_in_existing_thread_pool
33: std::thread::local::LocalKey<T>::with
34: scoped_tls::ScopedKey<T>::set
35: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.41.0-nightly (e87a205c2 2019-11-27) running on x86_64-apple-darwin
note: compiler flags: -Z mir-opt-level=2
query stack during panic:
end of query stack
error: aborting due to previous error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment