Closed
Description
$ rustc --version
rustc 1.20.0-nightly (bf0a9e0b4 2017-07-10)
$
$ rustc tmp.rs
error[E0080]: constant evaluation error
--> tmp.rs:3:18
|
3 | const B:i32 = A[0];
| ^^^^ index out of bounds: the len is 0 but the index is 0
error: internal compiler error: /checkout/src/librustc_trans/mir/constant.rs:378: _1 not initialized
--> tmp.rs:4:12
|
4 | let _ = &B;
| ^^
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.20.0-nightly (bf0a9e0b4 2017-07-10) running on x86_64-unknown-linux-gnu
thread 'rustc' panicked at 'Box<Any>', /checkout/src/librustc_errors/lib.rs:437:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
$
$ rustc-1.18.0 tmp.rs
error[E0080]: constant evaluation error
--> tmp.rs:3:18
|
3 | const B:i32 = A[0];
| ^^^^ index out of bounds: the len is 0 but the index is 0
error: internal compiler error: /checkout/src/librustc_trans/mir/constant.rs:377: _1 not initialized
--> tmp.rs:4:12
|
4 | let _ = &B;
| ^^
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 'Box<Any>', /checkout/src/librustc_errors/lib.rs:375
note: Run with `RUST_BACKTRACE=1` for a backtrace.
$
$ cat tmp.rs
fn main () {
const A:&[i32] = &[];
const B:i32 = A[0];
let _ = &B;
}
$