summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfcs/rfc-2005-default-binding-mode/slice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfcs/rfc-2005-default-binding-mode/slice.rs')
-rw-r--r--tests/ui/rfcs/rfc-2005-default-binding-mode/slice.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/rfcs/rfc-2005-default-binding-mode/slice.rs b/tests/ui/rfcs/rfc-2005-default-binding-mode/slice.rs
new file mode 100644
index 000000000..33229a205
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2005-default-binding-mode/slice.rs
@@ -0,0 +1,25 @@
+// run-pass
+
+fn slice_pat() {
+ let sl: &[u8] = b"foo";
+
+ match sl {
+ [first, remainder @ ..] => {
+ let _: &u8 = first;
+ assert_eq!(first, &b'f');
+ assert_eq!(remainder, b"oo");
+ }
+ [] => panic!(),
+ }
+}
+
+fn slice_pat_omission() {
+ match &[0, 1, 2] {
+ [..] => {}
+ };
+}
+
+fn main() {
+ slice_pat();
+ slice_pat_omission();
+}