Closed
Description
Compiler crashes on trivial match
I tried this code:
const ZERO: u8 = 0;
fn main() {
match 0 { _ => ZERO };
}
I expected to see this happen:
program compiles
Instead, this happened:
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/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: type_is_zero_size(bcx.ccx(), bcx.tcx().node_id_to_type(expr.id))', ../src/librustc_trans/expr.rs:159
Meta
rustc --version --verbose
:
rustc 1.9.0 (e4e8b6668 2016-05-18)
binary: rustc
commit-hash: e4e8b666850a763fdf1c3c2c142856ab51e32779
commit-date: 2016-05-18
host: x86_64-unknown-linux-gnu
release: 1.9.0
Backtrace:
1: 0x7f8c66820570 - std::sys::backtrace::tracing::imp::write::h4c73fcd3363076f5
2: 0x7f8c6682dc6b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h0422dbb3077e6747
3: 0x7f8c6682d80c - std::panicking::default_hook::haac48fa641db8fa2
4: 0x7f8c667f279f - std::sys_common::unwind::begin_unwind_inner::h39d40f52add53ef7
5: 0x7f8c6577bb7f - std::sys_common::unwind::begin_unwind::hd78480d5ec5c51b2
6: 0x7f8c657eb7cc - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
7: 0x7f8c658a457e - rustc_trans::_match::trans_match_inner::hed0f6414d25cfb0d
8: 0x7f8c65871165 - rustc_trans::expr::trans_rvalue_dps_unadjusted::hfc708f6d884d180a
9: 0x7f8c657ebd04 - rustc_trans::expr::trans_into::h42fcfc33be1fd4c2
10: 0x7f8c6584f75b - rustc_trans::controlflow::trans_stmt_semi::hcba83f2a6075f097
11: 0x7f8c657e34c0 - rustc_trans::controlflow::trans_block::hbf71b2a467189fc4
12: 0x7f8c657e1d35 - rustc_trans::base::trans_closure::h3bda42021fe9c927
13: 0x7f8c657e3f15 - rustc_trans::base::trans_fn::he1c838fa1dbfdc03
14: 0x7f8c657ee511 - rustc_trans::base::trans_item::hf167e469e36b8935
15: 0x7f8c6580672b - _<base..TransItemsWithinModVisitor<'a, 'tcx> as rustc..hir..intravisit..Visitor<'v>>::visit_item::hfd0663a7c8d5f16c
16: 0x7f8c657f4d1b - rustc_trans::base::trans_crate::h62301dd3c79c73a7
17: 0x7f8c66d7b74f - rustc_driver::driver::phase_4_translate_to_llvm::hd44e506f53bb81e3
18: 0x7f8c66d79e4b - rustc_driver::driver::compile_input::_$u7b$$u7b$closure$u7d$$u7d$::h9811bece2a8f1da7
19: 0x7f8c66d76720 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::hc699330eb6f2bc1e
20: 0x7f8c66d700d8 - rustc::ty::context::TyCtxt::create_and_enter::h656b2d3a4956519e
21: 0x7f8c66d6caee - rustc_driver::driver::phase_3_run_analysis_passes::h83da042ec4b8ea10
22: 0x7f8c66d3ef9f - rustc_driver::driver::compile_input::h6491aaddd9e61258
23: 0x7f8c66d254e4 - rustc_driver::run_compiler::h80b2ba5e4d787c5f
24: 0x7f8c66d22941 - std::sys_common::unwind::try::try_fn::h34e27823ddd1d5e9
25: 0x7f8c6681dd0b - __rust_try
26: 0x7f8c6681dc9d - std::sys_common::unwind::inner_try::h9eebd8dc83f388a6
27: 0x7f8c66d2318a - _<F as std..boxed..FnBox<A>>::call_box::h3d5d78986dfac5b2
28: 0x7f8c6682be04 - std::sys::thread::Thread::new::thread_start::h471ad90789353b5b
29: 0x7f8c5f212473 - start_thread
30: 0x7f8c6648a69c - clone
31: 0x0 - <unknown>