]> git.lizzy.rs Git - rust.git/commitdiff
--bless tests due to new subslice syntax.
authorMazdak Farrokhzad <twingoow@gmail.com>
Sun, 7 Jul 2019 23:58:28 +0000 (01:58 +0200)
committerMazdak Farrokhzad <twingoow@gmail.com>
Sun, 28 Jul 2019 04:53:39 +0000 (06:53 +0200)
14 files changed:
src/test/ui/borrowck/borrowck-describe-lvalue.stderr
src/test/ui/borrowck/borrowck-move-out-from-array.stderr
src/test/ui/borrowck/borrowck-slice-pattern-element-loan.stderr
src/test/ui/borrowck/borrowck-vec-pattern-move-tail.stderr
src/test/ui/borrowck/borrowck-vec-pattern-nesting.stderr
src/test/ui/error-codes/E0528.stderr
src/test/ui/feature-gates/feature-gate-slice-patterns.rs
src/test/ui/feature-gates/feature-gate-slice-patterns.stderr
src/test/ui/issues/issue-12369.stderr
src/test/ui/match/match-vec-mismatch.stderr
src/test/ui/parser/match-vec-invalid.rs
src/test/ui/parser/match-vec-invalid.stderr
src/test/ui/parser/pat-tuple-3.rs
src/test/ui/parser/pat-tuple-3.stderr

index 14b9b50f0c32a6352eeed0c16209e1aabf13411c..38d847a90ff958b36a864912746323552b9776a8 100644 (file)
@@ -192,8 +192,8 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
 LL |         let x = &mut v;
    |                 ------ borrow of `v` occurs here
 LL |         match v {
-LL |             &[x..] => println!("{:?}", x),
-   |               ^ use of borrowed `v`
+LL |             &[x @ ..] => println!("{:?}", x),
+   |               ^^^^^^ use of borrowed `v`
 ...
 LL |         drop(x);
    |              - borrow later used here
@@ -204,8 +204,8 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
 LL |         let x = &mut v;
    |                 ------ borrow of `v` occurs here
 ...
-LL |             &[_, x..] => println!("{:?}", x),
-   |                  ^ use of borrowed `v`
+LL |             &[_, x @ ..] => println!("{:?}", x),
+   |                  ^^^^^^ use of borrowed `v`
 ...
 LL |         drop(x);
    |              - borrow later used here
@@ -216,8 +216,8 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
 LL |         let x = &mut v;
    |                 ------ borrow of `v` occurs here
 ...
-LL |             &[x.., _] => println!("{:?}", x),
-   |               ^ use of borrowed `v`
+LL |             &[x @ .., _] => println!("{:?}", x),
+   |               ^^^^^^ use of borrowed `v`
 ...
 LL |         drop(x);
    |              - borrow later used here
@@ -228,8 +228,8 @@ error[E0503]: cannot use `v[..]` because it was mutably borrowed
 LL |         let x = &mut v;
    |                 ------ borrow of `v` occurs here
 ...
-LL |             &[_, x.., _] => println!("{:?}", x),
-   |                  ^ use of borrowed `v`
+LL |             &[_, x @ .., _] => println!("{:?}", x),
+   |                  ^^^^^^ use of borrowed `v`
 ...
 LL |         drop(x);
    |              - borrow later used here
index 16722a456defa4d54ea5048f5f72620f701fc46d..b34c03e6deff8d54151abb621335e6e47706339e 100644 (file)
@@ -13,8 +13,8 @@ error[E0382]: use of moved value: `a[..]`
    |
 LL |     let [_x, _] = a;
    |          -- value moved here
-LL |     let [_y..] = a;
-   |          ^^ value used here after move
+LL |     let [_y @ ..] = a;
+   |          ^^^^^^^ value used here after move
    |
    = note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
 
index f716ee68b00022448de4cf5641e460504e261b6d..2c019f446118208c962f48831809934022a7aa7e 100644 (file)
@@ -89,8 +89,8 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
    |
 LL |     if let [ref first, ref second, ..] = *s {
    |                        ---------- immutable borrow occurs here
-LL |         if let [_, ref mut tail..] = *s {
-   |                    ^^^^^^^^^^^^ mutable borrow occurs here
+LL |         if let [_, ref mut tail @ ..] = *s {
+   |                    ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
 LL |             nop(&[first, second]);
    |                          ------ immutable borrow later used here
 
@@ -99,18 +99,18 @@ error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as im
    |
 LL |     if let [.., ref second, ref first] = *s {
    |                 ---------- immutable borrow occurs here
-LL |         if let [ref mut tail.., _] = *s {
-   |                 ^^^^^^^^^^^^ mutable borrow occurs here
+LL |         if let [ref mut tail @ .., _] = *s {
+   |                 ^^^^^^^^^^^^^^^^^ mutable borrow occurs here
 LL |             nop(&[first, second]);
    |                          ------ immutable borrow later used here
 
 error[E0502]: cannot borrow `s[..]` as mutable because it is also borrowed as immutable
   --> $DIR/borrowck-slice-pattern-element-loan.rs:109:17
    |
-LL |     if let [_, _, _, ref s1..] = *s {
-   |                      ------ immutable borrow occurs here
-LL |         if let [ref mut s2.., _, _, _] = *s {
-   |                 ^^^^^^^^^^ mutable borrow occurs here
+LL |     if let [_, _, _, ref s1 @ ..] = *s {
+   |                      ----------- immutable borrow occurs here
+LL |         if let [ref mut s2 @ .., _, _, _] = *s {
+   |                 ^^^^^^^^^^^^^^^ mutable borrow occurs here
 LL |             nop_subslice(s1);
    |                          -- immutable borrow later used here
 
index b2f553ba49f70963119bf402b0935d62c9779883..9f8e6fe3b6898dcdbae751c069093f151aee5c94 100644 (file)
@@ -1,8 +1,8 @@
 error[E0506]: cannot assign to `a[_]` because it is borrowed
   --> $DIR/borrowck-vec-pattern-move-tail.rs:12:5
    |
-LL |         [1, 2, ref tail..] => tail,
-   |                -------- borrow of `a[_]` occurs here
+LL |         [1, 2, ref tail @ ..] => tail,
+   |                ------------- borrow of `a[_]` occurs here
 ...
 LL |     a[2] = 0;
    |     ^^^^^^^^ assignment to borrowed `a[_]` occurs here
index 072501f23ff840ae2654bc6db5408d290d2cf2f2..f54a3a4072cd215eaa0acea43a7cefd7e0211ec9 100644 (file)
@@ -13,8 +13,8 @@ LL |             _a.use_ref();
 error[E0506]: cannot assign to `vec[_]` because it is borrowed
   --> $DIR/borrowck-vec-pattern-nesting.rs:24:13
    |
-LL |         &mut [ref _b..] => {
-   |               ------ borrow of `vec[_]` occurs here
+LL |         &mut [ref _b @ ..] => {
+   |               ----------- borrow of `vec[_]` occurs here
 LL |
 LL |             vec[0] = box 4;
    |             ^^^^^^ assignment to borrowed `vec[_]` occurs here
index a7205af50542a35b811f3addffb898ca397dbc7c..0f566091145bffaf32458f923677a520690719ea 100644 (file)
@@ -1,8 +1,8 @@
 error[E0528]: pattern requires at least 3 elements but array has 2
   --> $DIR/E0528.rs:6:10
    |
-LL |         &[a, b, c, rest..] => {
-   |          ^^^^^^^^^^^^^^^^^ pattern cannot match array of 2 elements
+LL |         &[a, b, c, rest @ ..] => {
+   |          ^^^^^^^^^^^^^^^^^^^^ pattern cannot match array of 2 elements
 
 error: aborting due to previous error
 
index ad46c6fd3c2e07d291a3320afb24a0c490ae9a87..f2a1b135b69cbaab06ce2aeb5e549f4b720b9fca 100644 (file)
@@ -3,15 +3,15 @@
 fn main() {
     let x = [1, 2, 3, 4, 5];
     match x {
-        [1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
-        [1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
-        [.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
+        [1, 2, ..] => {} //~ ERROR subslice patterns are unstable
+        [1, .., 5] => {} //~ ERROR subslice patterns are unstable
+        [.., 4, 5] => {} //~ ERROR subslice patterns are unstable
     }
 
     let x = [ 1, 2, 3, 4, 5 ];
     match x {
-        [ xs @ .., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
-        [ 1, xs @ .., 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
-        [ 1, 2, xs @ .. ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
+        [ xs @ .., 4, 5 ] => {} //~ ERROR subslice patterns are unstable
+        [ 1, xs @ .., 5 ] => {} //~ ERROR subslice patterns are unstable
+        [ 1, 2, xs @ .. ] => {} //~ ERROR subslice patterns are unstable
     }
 }
index e88fddaa81fbeabb9c8e4aac3b755af990d51f82..d4946a42b8f3dcc307b9daf569468384de8028c5 100644 (file)
@@ -1,4 +1,4 @@
-error[E0658]: syntax for subslices in slice patterns is not yet stabilized
+error[E0658]: subslice patterns are unstable
   --> $DIR/feature-gate-slice-patterns.rs:6:16
    |
 LL |         [1, 2, ..] => {}
@@ -7,7 +7,7 @@ LL |         [1, 2, ..] => {}
    = note: for more information, see https://github.com/rust-lang/rust/issues/62254
    = help: add `#![feature(slice_patterns)]` to the crate attributes to enable
 
-error[E0658]: syntax for subslices in slice patterns is not yet stabilized
+error[E0658]: subslice patterns are unstable
   --> $DIR/feature-gate-slice-patterns.rs:7:13
    |
 LL |         [1, .., 5] => {}
@@ -16,7 +16,7 @@ LL |         [1, .., 5] => {}
    = note: for more information, see https://github.com/rust-lang/rust/issues/62254
    = help: add `#![feature(slice_patterns)]` to the crate attributes to enable
 
-error[E0658]: syntax for subslices in slice patterns is not yet stabilized
+error[E0658]: subslice patterns are unstable
   --> $DIR/feature-gate-slice-patterns.rs:8:10
    |
 LL |         [.., 4, 5] => {}
@@ -25,29 +25,29 @@ LL |         [.., 4, 5] => {}
    = note: for more information, see https://github.com/rust-lang/rust/issues/62254
    = help: add `#![feature(slice_patterns)]` to the crate attributes to enable
 
-error[E0658]: syntax for subslices in slice patterns is not yet stabilized
+error[E0658]: subslice patterns are unstable
   --> $DIR/feature-gate-slice-patterns.rs:13:11
    |
-LL |         [ xs.., 4, 5 ] => {}
-   |           ^^
+LL |         [ xs @ .., 4, 5 ] => {}
+   |           ^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/62254
    = help: add `#![feature(slice_patterns)]` to the crate attributes to enable
 
-error[E0658]: syntax for subslices in slice patterns is not yet stabilized
+error[E0658]: subslice patterns are unstable
   --> $DIR/feature-gate-slice-patterns.rs:14:14
    |
-LL |         [ 1, xs.., 5 ] => {}
-   |              ^^
+LL |         [ 1, xs @ .., 5 ] => {}
+   |              ^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/62254
    = help: add `#![feature(slice_patterns)]` to the crate attributes to enable
 
-error[E0658]: syntax for subslices in slice patterns is not yet stabilized
+error[E0658]: subslice patterns are unstable
   --> $DIR/feature-gate-slice-patterns.rs:15:17
    |
-LL |         [ 1, 2, xs.. ] => {}
-   |                 ^^
+LL |         [ 1, 2, xs @ .. ] => {}
+   |                 ^^^^^^^
    |
    = note: for more information, see https://github.com/rust-lang/rust/issues/62254
    = help: add `#![feature(slice_patterns)]` to the crate attributes to enable
index fec9078dc409094cb33b210f7c8b24ce78541567..f27425e28c61d3d9b12af0af8aea6658c8c2ce89 100644 (file)
@@ -1,8 +1,8 @@
 error: unreachable pattern
   --> $DIR/issue-12369.rs:10:9
    |
-LL |         &[10,a, ref rest..] => 10
-   |         ^^^^^^^^^^^^^^^^^^^
+LL |         &[10,a, ref rest @ ..] => 10
+   |         ^^^^^^^^^^^^^^^^^^^^^^
    |
 note: lint level defined here
   --> $DIR/issue-12369.rs:2:9
index 47f9d48e26290a32e3ccb63dc286af5b9833cd6e..2f1bbb7621659c6641661486201b0c0f61f6890e 100644 (file)
@@ -19,8 +19,8 @@ LL |         [0] => {},
 error[E0528]: pattern requires at least 4 elements but array has 3
   --> $DIR/match-vec-mismatch.rs:25:9
    |
-LL |         [0, 1, 2, 3, x..] => {}
-   |         ^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements
+LL |         [0, 1, 2, 3, x @ ..] => {}
+   |         ^^^^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements
 
 error[E0282]: type annotations needed
   --> $DIR/match-vec-mismatch.rs:36:9
index 269f2ce85a349d33c78ecdb3bd4ed9717709c77e..d14fdc4e22e318930021eb25a052ec976a1a0148 100644 (file)
@@ -1,7 +1,12 @@
 fn main() {
     let a = Vec::new();
     match a {
-        [1, tail @ .., tail @ ..] => {}, //~ ERROR: expected one of `,` or `@`, found `..`
+        [1, tail @ .., tail @ ..] => {},
+        //~^ ERROR identifier `tail` is bound more than once in the same pattern
+        //~| ERROR subslice patterns are unstable
+        //~| ERROR subslice patterns are unstable
+        //~| ERROR `..` can only be used once per slice pattern
+        //~| ERROR expected an array or slice, found `std::vec::Vec<_>`
         _ => ()
     }
 }
index fee8d248dcf07f68c7a00f72923c047492e2eb8d..0de9a752347585b2e62835a5f09ec35d0027390e 100644 (file)
@@ -1,8 +1,42 @@
-error: expected one of `,` or `@`, found `..`
-  --> $DIR/match-vec-invalid.rs:4:25
+error[E0416]: identifier `tail` is bound more than once in the same pattern
+  --> $DIR/match-vec-invalid.rs:4:24
    |
-LL |         [1, tail.., tail..] => {},
-   |                         ^^ expected one of `,` or `@` here
+LL |         [1, tail @ .., tail @ ..] => {},
+   |                        ^^^^ used in a pattern more than once
 
-error: aborting due to previous error
+error[E0658]: subslice patterns are unstable
+  --> $DIR/match-vec-invalid.rs:4:13
+   |
+LL |         [1, tail @ .., tail @ ..] => {},
+   |             ^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/62254
+   = help: add #![feature(slice_patterns)] to the crate attributes to enable
+
+error[E0658]: subslice patterns are unstable
+  --> $DIR/match-vec-invalid.rs:4:24
+   |
+LL |         [1, tail @ .., tail @ ..] => {},
+   |                        ^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/62254
+   = help: add #![feature(slice_patterns)] to the crate attributes to enable
+
+error: `..` can only be used once per slice pattern
+  --> $DIR/match-vec-invalid.rs:4:31
+   |
+LL |         [1, tail @ .., tail @ ..] => {},
+   |                    --         ^^ can only be used once per slice pattern
+   |                    |
+   |                    previously used here
+
+error[E0529]: expected an array or slice, found `std::vec::Vec<_>`
+  --> $DIR/match-vec-invalid.rs:4:9
+   |
+LL |         [1, tail @ .., tail @ ..] => {},
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^ pattern cannot match with input type `std::vec::Vec<_>`
+
+error: aborting due to 5 previous errors
 
+Some errors have detailed explanations: E0416, E0529, E0658.
+For more information about an error, try `rustc --explain E0416`.
index e1e975d3c3ea04b3a7d3a42b434d2a9f998ce65e..1486ab231aab4f084fc404433339616c803179c5 100644 (file)
@@ -1,6 +1,6 @@
 fn main() {
     match (0, 1, 2) {
         (.., pat, ..) => {}
-        //~^ ERROR `..` can only be used once per tuple or tuple struct pattern
+        //~^ ERROR `..` can only be used once per tuple pattern
     }
 }
index c9f14bb90429b90e3c0b97cf456bf8aa8760c1b9..9ac0611c5c933230c2d8b82ab9e149babeca997c 100644 (file)
@@ -1,10 +1,10 @@
-error: `..` can only be used once per tuple or tuple struct pattern
+error: `..` can only be used once per tuple pattern
   --> $DIR/pat-tuple-3.rs:3:19
    |
 LL |         (.., pat, ..) => {}
-   |          --       ^^ can only be used once per pattern
+   |          --       ^^ can only be used once per tuple pattern
    |          |
-   |          previously present here
+   |          previously used here
 
 error: aborting due to previous error