about summary refs log tree commit diff
path: root/src/test/ui/array-slice-vec
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-07-08 01:47:46 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-07-28 06:53:39 +0200
commit75da43dc87a9fee3fc1ef5cffb4a6721ef4bd2ba (patch)
tree3d90c5ef535ada61cc549e97ab56987cc4b502b7 /src/test/ui/array-slice-vec
parent891a736b0206f9646803475bed1aeb7ac9efcadd (diff)
downloadrust-75da43dc87a9fee3fc1ef5cffb4a6721ef4bd2ba.tar.gz
rust-75da43dc87a9fee3fc1ef5cffb4a6721ef4bd2ba.zip
Use new 'p @ ..' syntax in tests.
Diffstat (limited to 'src/test/ui/array-slice-vec')
-rw-r--r--src/test/ui/array-slice-vec/vec-matching-fold.rs4
-rw-r--r--src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs2
-rw-r--r--src/test/ui/array-slice-vec/vec-matching.rs27
-rw-r--r--src/test/ui/array-slice-vec/vec-tail-matching.rs4
4 files changed, 11 insertions, 26 deletions
diff --git a/src/test/ui/array-slice-vec/vec-matching-fold.rs b/src/test/ui/array-slice-vec/vec-matching-fold.rs
index 2b19c49c427..f416160db24 100644
--- a/src/test/ui/array-slice-vec/vec-matching-fold.rs
+++ b/src/test/ui/array-slice-vec/vec-matching-fold.rs
@@ -11,7 +11,7 @@ fn foldl<T, U, F>(values: &[T],
     U: Clone+Debug, T:Debug,
     F: FnMut(U, &T) -> U,
 {    match values {
-        &[ref head, ref tail..] =>
+        &[ref head, ref tail @ ..] =>
             foldl(tail, function(initial, head), function),
         &[] => {
             // FIXME: call guards
@@ -28,7 +28,7 @@ fn foldr<T, U, F>(values: &[T],
     F: FnMut(&T, U) -> U,
 {
     match values {
-        &[ref head.., ref tail] =>
+        &[ref head @ .., ref tail] =>
             foldr(head, function(tail, initial), function),
         &[] => {
             // FIXME: call guards
diff --git a/src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs b/src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs
index bce03b3375e..f0602c328b0 100644
--- a/src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs
+++ b/src/test/ui/array-slice-vec/vec-matching-legal-tail-element-borrow.rs
@@ -8,7 +8,7 @@ pub fn main() {
     let x: &[isize] = &[1, 2, 3, 4, 5];
     if !x.is_empty() {
         let el = match x {
-            &[1, ref tail..] => &tail[0],
+            &[1, ref tail @ ..] => &tail[0],
             _ => unreachable!()
         };
         println!("{}", *el);
diff --git a/src/test/ui/array-slice-vec/vec-matching.rs b/src/test/ui/array-slice-vec/vec-matching.rs
index a37c25160fa..49c736bd728 100644
--- a/src/test/ui/array-slice-vec/vec-matching.rs
+++ b/src/test/ui/array-slice-vec/vec-matching.rs
@@ -14,7 +14,7 @@ fn a() {
 fn b() {
     let x = [1, 2, 3];
     match x {
-        [a, b, c..] => {
+        [a, b, c @ ..] => {
             assert_eq!(a, 1);
             assert_eq!(b, 2);
             let expected: &[_] = &[3];
@@ -22,7 +22,7 @@ fn b() {
         }
     }
     match x {
-        [a.., b, c] => {
+        [a @ .., b, c] => {
             let expected: &[_] = &[1];
             assert_eq!(a, expected);
             assert_eq!(b, 2);
@@ -30,7 +30,7 @@ fn b() {
         }
     }
     match x {
-        [a, b.., c] => {
+        [a, b @ .., c] => {
             assert_eq!(a, 1);
             let expected: &[_] = &[2];
             assert_eq!(b, expected);
@@ -50,7 +50,7 @@ fn b() {
 fn b_slice() {
     let x : &[_] = &[1, 2, 3];
     match x {
-        &[a, b, ref c..] => {
+        &[a, b, ref c @ ..] => {
             assert_eq!(a, 1);
             assert_eq!(b, 2);
             let expected: &[_] = &[3];
@@ -59,7 +59,7 @@ fn b_slice() {
         _ => unreachable!()
     }
     match x {
-        &[ref a.., b, c] => {
+        &[ref a @ .., b, c] => {
             let expected: &[_] = &[1];
             assert_eq!(a, expected);
             assert_eq!(b, 2);
@@ -68,7 +68,7 @@ fn b_slice() {
         _ => unreachable!()
     }
     match x {
-        &[a, ref b.., c] => {
+        &[a, ref b @ .., c] => {
             assert_eq!(a, 1);
             let expected: &[_] = &[2];
             assert_eq!(b, expected);
@@ -134,20 +134,6 @@ 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();
@@ -155,5 +141,4 @@ pub fn main() {
     c();
     d();
     e();
-    f();
 }
diff --git a/src/test/ui/array-slice-vec/vec-tail-matching.rs b/src/test/ui/array-slice-vec/vec-tail-matching.rs
index 84d246dff82..3c7b160dcc5 100644
--- a/src/test/ui/array-slice-vec/vec-tail-matching.rs
+++ b/src/test/ui/array-slice-vec/vec-tail-matching.rs
@@ -13,14 +13,14 @@ pub fn main() {
         Foo { string: "baz" }
     ];
     match x {
-        [ref first, ref tail..] => {
+        [ref first, ref tail @ ..] => {
             assert_eq!(first.string, "foo");
             assert_eq!(tail.len(), 2);
             assert_eq!(tail[0].string, "bar");
             assert_eq!(tail[1].string, "baz");
 
             match *(tail as &[_]) {
-                [Foo { .. }, _, Foo { .. }, ref _tail..] => {
+                [Foo { .. }, _, Foo { .. }, ref _tail @ ..] => {
                     unreachable!();
                 }
                 [Foo { string: ref a }, Foo { string: ref b }] => {