diff options
Diffstat (limited to 'src/test/ui/mir/mir_indexing_oob_2.rs')
-rw-r--r-- | src/test/ui/mir/mir_indexing_oob_2.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/mir/mir_indexing_oob_2.rs b/src/test/ui/mir/mir_indexing_oob_2.rs new file mode 100644 index 000000000..a9e850570 --- /dev/null +++ b/src/test/ui/mir/mir_indexing_oob_2.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: &'static [u8; 5] = b"hello"; + +#[allow(unconditional_panic)] +fn test() -> u8 { + C[10] +} + +fn main() { + test(); +} |