]> git.proxmox.com Git - rustc.git/blobdiff - src/test/run-pass/vec-matching.rs
New upstream version 1.14.0+dfsg1
[rustc.git] / src / test / run-pass / vec-matching.rs
index 97006f54cd9551f07feb03256ae448f993202aae..bd0731a555cb6d80feef08a5c33d975580936f2b 100644 (file)
@@ -144,6 +144,20 @@ fn e() {
     assert_eq!(c, 1);
 }
 
+fn f() {
+    let x = &[1, 2, 3, 4, 5];
+    let [a, [b, [c, ..].., d].., e] = *x;
+    assert_eq!((a, b, c, d, e), (1, 2, 3, 4, 5));
+
+    let x: &[isize] = x;
+    let (a, b, c, d, e) = match *x {
+        [a, [b, [c, ..].., d].., e] => (a, b, c, d, e),
+        _ => unimplemented!()
+    };
+
+    assert_eq!((a, b, c, d, e), (1, 2, 3, 4, 5));
+}
+
 pub fn main() {
     a();
     b();
@@ -151,4 +165,5 @@ pub fn main() {
     c();
     d();
     e();
+    f();
 }