Account for better recovery in two cases.

This commit is contained in:
Mazdak Farrokhzad 2019-07-09 06:30:03 +02:00
parent e725ea2215
commit 06e5ae5c82
4 changed files with 43 additions and 2 deletions

View file

@ -1,3 +1,6 @@
fn main() {
let Test(&desc[..]) = x; //~ ERROR: expected one of `)`, `,`, or `@`, found `[`
//~^ ERROR cannot find value `x` in this scope
//~| ERROR cannot find tuple struct/variant `Test` in this scope
//~| ERROR subslice patterns are unstable
}

View file

@ -4,5 +4,28 @@ error: expected one of `)`, `,`, or `@`, found `[`
LL | let Test(&desc[..]) = x;
| ^ expected one of `)`, `,`, or `@` here
error: aborting due to previous error
error[E0425]: cannot find value `x` in this scope
--> $DIR/pat-lt-bracket-6.rs:2:27
|
LL | let Test(&desc[..]) = x;
| ^ not found in this scope
error[E0531]: cannot find tuple struct/variant `Test` in this scope
--> $DIR/pat-lt-bracket-6.rs:2:9
|
LL | let Test(&desc[..]) = x;
| ^^^^ not found in this scope
error[E0658]: subslice patterns are unstable
--> $DIR/pat-lt-bracket-6.rs:2:20
|
LL | let Test(&desc[..]) = x;
| ^^
|
= 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: aborting due to 4 previous errors
Some errors have detailed explanations: E0425, E0658.
For more information about an error, try `rustc --explain E0425`.

View file

@ -1,3 +1,5 @@
fn main() {
for thing(x[]) in foo {} //~ ERROR: expected one of `)`, `,`, or `@`, found `[`
//~^ ERROR cannot find value `foo` in this scope
//~| ERROR cannot find tuple struct/variant `thing` in this scope
}

View file

@ -4,5 +4,18 @@ error: expected one of `)`, `,`, or `@`, found `[`
LL | for thing(x[]) in foo {}
| ^ expected one of `)`, `,`, or `@` here
error: aborting due to previous error
error[E0425]: cannot find value `foo` in this scope
--> $DIR/pat-lt-bracket-7.rs:2:23
|
LL | for thing(x[]) in foo {}
| ^^^ not found in this scope
error[E0531]: cannot find tuple struct/variant `thing` in this scope
--> $DIR/pat-lt-bracket-7.rs:2:9
|
LL | for thing(x[]) in foo {}
| ^^^^^ not found in this scope
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0425`.