summaryrefslogtreecommitdiffstats
path: root/src/test/ui/array-slice-vec/dst-raw-slice.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/array-slice-vec/dst-raw-slice.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/dst-raw-slice.rs b/src/test/ui/array-slice-vec/dst-raw-slice.rs
new file mode 100644
index 000000000..371d16f09
--- /dev/null
+++ b/src/test/ui/array-slice-vec/dst-raw-slice.rs
@@ -0,0 +1,13 @@
+// Test bounds checking for DST raw slices
+
+// run-fail
+// error-pattern:index out of bounds
+// ignore-emscripten no processes
+
+#[allow(unconditional_panic)]
+fn main() {
+ let a: *const [_] = &[1, 2, 3];
+ unsafe {
+ let _b = (*a)[3];
+ }
+}