diff options
Diffstat (limited to 'src/test/ui/binding/zero_sized_subslice_match.rs')
-rw-r--r-- | src/test/ui/binding/zero_sized_subslice_match.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/binding/zero_sized_subslice_match.rs b/src/test/ui/binding/zero_sized_subslice_match.rs new file mode 100644 index 000000000..187c29836 --- /dev/null +++ b/src/test/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 ()) + } +} |