summaryrefslogtreecommitdiffstats
path: root/tests/ui/binding/zero_sized_subslice_match.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/binding/zero_sized_subslice_match.rs')
-rw-r--r--tests/ui/binding/zero_sized_subslice_match.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/binding/zero_sized_subslice_match.rs b/tests/ui/binding/zero_sized_subslice_match.rs
new file mode 100644
index 000000000..187c29836
--- /dev/null
+++ b/tests/ui/binding/zero_sized_subslice_match.rs
@@ -0,0 +1,11 @@
+// run-pass
+
+fn main() {
+ let x = [(), ()];
+
+ // The subslice used to go out of bounds for zero-sized array items, check that this doesn't
+ // happen anymore
+ match x {
+ [_, ref y @ ..] => assert_eq!(&x[1] as *const (), &y[0] as *const ())
+ }
+}