rust/tests/ui/array-slice-vec/array_const_index-0.rs

9 lines
193 B
Rust
Raw Normal View History

const A: &'static [i32] = &[];
const B: i32 = (&A)[1];
//~^ index out of bounds: the length is 0 but the index is 1
2022-09-21 06:05:20 -05:00
//~| ERROR evaluation of constant value failed
2015-11-18 03:57:52 -06:00
fn main() {
let _ = B;
2015-11-18 03:57:52 -06:00
}