summaryrefslogtreecommitdiffstats
path: root/src/test/ui/mir/mir_indexing_oob_3.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/mir/mir_indexing_oob_3.rs')
-rw-r--r--src/test/ui/mir/mir_indexing_oob_3.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/test/ui/mir/mir_indexing_oob_3.rs b/src/test/ui/mir/mir_indexing_oob_3.rs
new file mode 100644
index 000000000..4f5cab59b
--- /dev/null
+++ b/src/test/ui/mir/mir_indexing_oob_3.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 mir() -> u8 {
+ C[10]
+}
+
+fn main() {
+ mir();
+}