about summary refs log tree commit diff
path: root/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/array-slice-vec/bounds-check-no-overflow.rs')
-rw-r--r--src/test/ui/array-slice-vec/bounds-check-no-overflow.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs b/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs
new file mode 100644
index 00000000000..3caf5f44995
--- /dev/null
+++ b/src/test/ui/array-slice-vec/bounds-check-no-overflow.rs
@@ -0,0 +1,11 @@
+// run-fail
+// error-pattern:index out of bounds
+// ignore-emscripten no processes
+
+use std::usize;
+use std::mem::size_of;
+
+fn main() {
+    let xs = [1, 2, 3];
+    xs[usize::MAX / size_of::<isize>() + 1];
+}