diff options
Diffstat (limited to 'tests/ui/mir/mir_indexing_oob_1.rs')
-rw-r--r-- | tests/ui/mir/mir_indexing_oob_1.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/mir/mir_indexing_oob_1.rs b/tests/ui/mir/mir_indexing_oob_1.rs new file mode 100644 index 000000000..6d769b6b2 --- /dev/null +++ b/tests/ui/mir/mir_indexing_oob_1.rs @@ -0,0 +1,14 @@ +// run-fail +// error-pattern:index out of bounds: the len is 5 but the index is 10 +// ignore-emscripten no processes + +const C: [u32; 5] = [0; 5]; + +#[allow(unconditional_panic)] +fn test() -> u32 { + C[10] +} + +fn main() { + test(); +} |