diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-08 01:58:28 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-28 06:53:39 +0200 |
| commit | 91c8b53f458ef6efb3640a359dba4015848fd9d1 (patch) | |
| tree | e2290604be8794c9bff156ac23f920355718ad06 /src/test/ui/parser | |
| parent | 75da43dc87a9fee3fc1ef5cffb4a6721ef4bd2ba (diff) | |
| download | rust-91c8b53f458ef6efb3640a359dba4015848fd9d1.tar.gz rust-91c8b53f458ef6efb3640a359dba4015848fd9d1.zip | |
--bless tests due to new subslice syntax.
Diffstat (limited to 'src/test/ui/parser')
| -rw-r--r-- | src/test/ui/parser/match-vec-invalid.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/parser/match-vec-invalid.stderr | 44 | ||||
| -rw-r--r-- | src/test/ui/parser/pat-tuple-3.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/parser/pat-tuple-3.stderr | 6 |
4 files changed, 49 insertions, 10 deletions
diff --git a/src/test/ui/parser/match-vec-invalid.rs b/src/test/ui/parser/match-vec-invalid.rs index 269f2ce85a3..d14fdc4e22e 100644 --- a/src/test/ui/parser/match-vec-invalid.rs +++ b/src/test/ui/parser/match-vec-invalid.rs @@ -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<_>` _ => () } } diff --git a/src/test/ui/parser/match-vec-invalid.stderr b/src/test/ui/parser/match-vec-invalid.stderr index fee8d248dcf..0de9a752347 100644 --- a/src/test/ui/parser/match-vec-invalid.stderr +++ b/src/test/ui/parser/match-vec-invalid.stderr @@ -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`. diff --git a/src/test/ui/parser/pat-tuple-3.rs b/src/test/ui/parser/pat-tuple-3.rs index e1e975d3c3e..1486ab231aa 100644 --- a/src/test/ui/parser/pat-tuple-3.rs +++ b/src/test/ui/parser/pat-tuple-3.rs @@ -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 } } diff --git a/src/test/ui/parser/pat-tuple-3.stderr b/src/test/ui/parser/pat-tuple-3.stderr index c9f14bb9042..9ac0611c5c9 100644 --- a/src/test/ui/parser/pat-tuple-3.stderr +++ b/src/test/ui/parser/pat-tuple-3.stderr @@ -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 |
