rust/src/test/ui/array-slice-vec/array_const_index-0.rs
2021-02-03 15:45:43 +01:00

9 lines
278 B
Rust

const A: &'static [i32] = &[];
const B: i32 = (&A)[1];
//~^ index out of bounds: the length is 0 but the index is 1
//~| ERROR any use of this value will cause an error
//~| WARN this was previously accepted by the compiler but is being phased out
fn main() {
let _ = B;
}