rust/src/test/run-fail/mir_indexing_oob_1.rs

13 lines
186 B
Rust
Raw Normal View History

2015-12-21 10:58:18 -06:00
// error-pattern:index out of bounds: the len is 5 but the index is 10
const C: [u32; 5] = [0; 5];
2020-02-15 12:02:36 -06:00
#[allow(panic, const_err)]
2015-12-21 10:58:18 -06:00
fn test() -> u32 {
C[10]
}
fn main() {
test();
}