rust/tests/ui/consts/const-slice-oob.rs
2025-04-08 23:06:31 +03:00

9 lines
209 B
Rust

const FOO: &'static[u32] = &[1, 2, 3];
const BAR: u32 = FOO[5];
//~^ NOTE index out of bounds: the length is 3 but the index is 5
//~| ERROR evaluation of constant value failed
fn main() {
let _ = BAR;
}