about summary refs log tree commit diff
path: root/src/test/ui/mir/mir_indexing_oob_2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/mir/mir_indexing_oob_2.rs')
-rw-r--r--src/test/ui/mir/mir_indexing_oob_2.rs13
1 files changed, 13 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 00000000000..03b3ea01d6b
--- /dev/null
+++ b/src/test/ui/mir/mir_indexing_oob_2.rs
@@ -0,0 +1,13 @@
+// run-fail
+// error-pattern:index out of bounds: the len is 5 but the index is 10
+
+const C: &'static [u8; 5] = b"hello";
+
+#[allow(unconditional_panic)]
+fn test() -> u8 {
+    C[10]
+}
+
+fn main() {
+    test();
+}