Closed
Description
Summary
rustc
1.9.0-beta.1 panics when a constant index expression is out of bounds in a range expression.
Minimal Code to Reproduce
const A: [u32; 1] = [0];
fn test() {
let range = A[1]..; // <- note range
}
Expected Behavior
Compilation failure and exit (without a panic). rustc
1.8.0 catches this properly without panicking:
src/lib.rs:4:14: 4:18 error: const index-expr is out of bounds [E0515]
src/lib.rs:4 let range = A[1]..;
^~~~
src/lib.rs:4:14: 4:18 help: run `rustc --explain E0515` to see a detailed explanation
error: aborting due to previous error
Could not compile `rustc-bug`.
Actual Behavior
rustc
1.9.0-beta.1 also catches the error but then immediately panics:
src/lib.rs:4:14: 4:18 error: const index-expr is out of bounds [E0515]
src/lib.rs:4 let range = A[1]..;
^~~~
src/lib.rs:4:14: 4:18 help: run `rustc --explain E0515` to see a detailed explanation
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
thread 'rustc' panicked at 'assertion failed: !is_undef(val)', ../src/librustc_trans/adt.rs:1442
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Could not compile `rustc-bug`.
To learn more, run the command again with --verbose.
Meta
rustc version
rustc 1.9.0-beta.1 (37a2869af 2016-04-12)
binary: rustc
commit-hash: 37a2869afa7eb0813becaf0070874806030052df
commit-date: 2016-04-12
host: x86_64-unknown-linux-gnu
release: 1.9.0-beta.1
Backtrace
thread 'rustc' panicked at 'assertion failed: !is_undef(val)', ../src/librustc_trans/adt.rs:1442
stack backtrace:
1: 0x7fd7dbc0b8f0 - std::sys::backtrace::tracing::imp::write::h25f26530b3b48a54
2: 0x7fd7dbc18feb - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hb497e646e4148afc
3: 0x7fd7dbc18b8c - std::panicking::default_hook::hd57825f8b5247927
4: 0x7fd7dbbdd94f - std::sys_common::unwind::begin_unwind_inner::hf40013815c474ad4
5: 0x7fd7dab6462f - std::sys_common::unwind::begin_unwind::h92dcc321186dc34c
6: 0x7fd7daba4364 - rustc_trans::adt::build_const_struct::h7c2193a6829ece18
7: 0x7fd7daba324b - rustc_trans::adt::trans_const::hef58b8dec6cea773
8: 0x7fd7dac277e2 - rustc_trans::consts::const_expr_unadjusted::h2a808f520395dbc1
9: 0x7fd7dac236f5 - rustc_trans::consts::const_expr::hd1077cfffb24f3fd
10: 0x7fd7dac25d9a - rustc_trans::consts::const_expr_unadjusted::h2a808f520395dbc1
11: 0x7fd7dac236f5 - rustc_trans::consts::const_expr::hd1077cfffb24f3fd
12: 0x7fd7dac24bed - rustc_trans::consts::get_const_expr_as_global::h461bf6e23752d380
13: 0x7fd7dabd2491 - rustc_trans::expr::trans_into::hec8593fa54ef6bb1
14: 0x7fd7dac9541d - rustc_trans::_match::mk_binding_alloca::h371f10e5648554d4
15: 0x7fd7dabb466d - rustc_trans::base::init_local::hfca9341188244db9
16: 0x7fd7dabca274 - rustc_trans::controlflow::trans_block::h1af7b1b31248e1b6
17: 0x7fd7dabc8ac5 - rustc_trans::base::trans_closure::h5d45bbd73c3a7a78
18: 0x7fd7dabcaca5 - rustc_trans::base::trans_fn::h402b71919a8efd00
19: 0x7fd7dabd52a1 - rustc_trans::base::trans_item::ha1b4ec4be38cfb98
20: 0x7fd7dabedc9b - _<base..TransItemsWithinModVisitor<'a, 'tcx> as rustc..hir..intravisit..Visitor<'v>>::visit_item::h28deed87cec6b591
21: 0x7fd7dabdc12b - rustc_trans::base::trans_crate::hb76ff2cab32def4b
22: 0x7fd7dc16607f - rustc_driver::driver::phase_4_translate_to_llvm::h4ddb9e99a379fd22
23: 0x7fd7dc16477b - rustc_driver::driver::compile_input::_$u7b$$u7b$closure$u7d$$u7d$::h055be3d7512cb25b
24: 0x7fd7dc1610f0 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::h8b22036e53339e21
25: 0x7fd7dc15abcb - rustc::ty::context::TyCtxt::create_and_enter::h46f82c7d33538844
26: 0x7fd7dc15767e - rustc_driver::driver::phase_3_run_analysis_passes::ha8983b62bc1b2b22
27: 0x7fd7dc129ecf - rustc_driver::driver::compile_input::h03d180f0197cc850
28: 0x7fd7dc110414 - rustc_driver::run_compiler::he6931cc1e4c34ecf
29: 0x7fd7dc10d871 - std::sys_common::unwind::try::try_fn::h4268a1ea4d20bd31
30: 0x7fd7dbc0908b - __rust_try
31: 0x7fd7dbc0901d - std::sys_common::unwind::inner_try::h03f2e7dcfdd826c0
32: 0x7fd7dc10e0ba - _<F as std..boxed..FnBox<A>>::call_box::h570318fe7233955a
33: 0x7fd7dbc17184 - std::sys::thread::Thread::new::thread_start::h42a605e44c815beb
34: 0x7fd7d462a453 - start_thread
35: 0x7fd7db873edc - clone
36: 0x0 - <unknown>