Skip to content

Commit 06e5ae5

Browse files
committed
Account for better recovery in two cases.
1 parent e725ea2 commit 06e5ae5

File tree

4 files changed

+43
-2
lines changed

4 files changed

+43
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
fn main() {
22
let Test(&desc[..]) = x; //~ ERROR: expected one of `)`, `,`, or `@`, found `[`
3+
//~^ ERROR cannot find value `x` in this scope
4+
//~| ERROR cannot find tuple struct/variant `Test` in this scope
5+
//~| ERROR subslice patterns are unstable
36
}

src/test/ui/parser/pat-lt-bracket-6.stderr

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,28 @@ error: expected one of `)`, `,`, or `@`, found `[`
44
LL | let Test(&desc[..]) = x;
55
| ^ expected one of `)`, `,`, or `@` here
66

7-
error: aborting due to previous error
7+
error[E0425]: cannot find value `x` in this scope
8+
--> $DIR/pat-lt-bracket-6.rs:2:27
9+
|
10+
LL | let Test(&desc[..]) = x;
11+
| ^ not found in this scope
12+
13+
error[E0531]: cannot find tuple struct/variant `Test` in this scope
14+
--> $DIR/pat-lt-bracket-6.rs:2:9
15+
|
16+
LL | let Test(&desc[..]) = x;
17+
| ^^^^ not found in this scope
18+
19+
error[E0658]: subslice patterns are unstable
20+
--> $DIR/pat-lt-bracket-6.rs:2:20
21+
|
22+
LL | let Test(&desc[..]) = x;
23+
| ^^
24+
|
25+
= note: for more information, see https://github.com/rust-lang/rust/issues/62254
26+
= help: add #![feature(slice_patterns)] to the crate attributes to enable
27+
28+
error: aborting due to 4 previous errors
829

30+
Some errors have detailed explanations: E0425, E0658.
31+
For more information about an error, try `rustc --explain E0425`.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
fn main() {
22
for thing(x[]) in foo {} //~ ERROR: expected one of `)`, `,`, or `@`, found `[`
3+
//~^ ERROR cannot find value `foo` in this scope
4+
//~| ERROR cannot find tuple struct/variant `thing` in this scope
35
}

src/test/ui/parser/pat-lt-bracket-7.stderr

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,18 @@ error: expected one of `)`, `,`, or `@`, found `[`
44
LL | for thing(x[]) in foo {}
55
| ^ expected one of `)`, `,`, or `@` here
66

7-
error: aborting due to previous error
7+
error[E0425]: cannot find value `foo` in this scope
8+
--> $DIR/pat-lt-bracket-7.rs:2:23
9+
|
10+
LL | for thing(x[]) in foo {}
11+
| ^^^ not found in this scope
12+
13+
error[E0531]: cannot find tuple struct/variant `thing` in this scope
14+
--> $DIR/pat-lt-bracket-7.rs:2:9
15+
|
16+
LL | for thing(x[]) in foo {}
17+
| ^^^^^ not found in this scope
18+
19+
error: aborting due to 3 previous errors
820

21+
For more information about this error, try `rustc --explain E0425`.

0 commit comments

Comments
 (0)