Skip to content

Commit 5f4dd1d

Browse files
committed
Address comments re. off-topic errors.
1 parent becdba8 commit 5f4dd1d

6 files changed

+48
-44
lines changed
+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
fn main() {
2-
let a = Vec::new();
2+
let a: &[u8] = &[];
33
match a {
44
[1, tail @ .., tail @ ..] => {},
55
//~^ ERROR identifier `tail` is bound more than once in the same pattern
66
//~| ERROR subslice patterns are unstable
77
//~| ERROR subslice patterns are unstable
88
//~| ERROR `..` can only be used once per slice pattern
9-
//~| ERROR expected an array or slice, found `std::vec::Vec<_>`
109
_ => ()
1110
}
1211
}
12+
13+
const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types

src/test/ui/parser/match-vec-invalid.stderr

+9-6
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,16 @@ LL | [1, tail @ .., tail @ ..] => {},
3030
| |
3131
| previously used here
3232

33-
error[E0529]: expected an array or slice, found `std::vec::Vec<_>`
34-
--> $DIR/match-vec-invalid.rs:4:9
33+
error[E0308]: mismatched types
34+
--> $DIR/match-vec-invalid.rs:13:30
3535
|
36-
LL | [1, tail @ .., tail @ ..] => {},
37-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ pattern cannot match with input type `std::vec::Vec<_>`
36+
LL | const RECOVERY_WITNESS: () = 0;
37+
| ^ expected (), found integer
38+
|
39+
= note: expected type `()`
40+
found type `{integer}`
3841

3942
error: aborting due to 5 previous errors
4043

41-
Some errors have detailed explanations: E0416, E0529, E0658.
42-
For more information about an error, try `rustc --explain E0416`.
44+
Some errors have detailed explanations: E0308, E0416, E0658.
45+
For more information about an error, try `rustc --explain E0308`.
+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
fn main() {
2+
struct Test(&'static u8, [u8; 0]);
3+
let x = Test(&0, []);
4+
25
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
6+
//~^ ERROR subslice patterns are unstable
67
}
8+
9+
const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types
+14-17
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,28 @@
11
error: expected one of `)`, `,`, or `@`, found `[`
2-
--> $DIR/pat-lt-bracket-6.rs:2:19
2+
--> $DIR/pat-lt-bracket-6.rs:5:19
33
|
44
LL | let Test(&desc[..]) = x;
55
| ^ expected one of `)`, `,`, or `@` here
66

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-
197
error[E0658]: subslice patterns are unstable
20-
--> $DIR/pat-lt-bracket-6.rs:2:20
8+
--> $DIR/pat-lt-bracket-6.rs:5:20
219
|
2210
LL | let Test(&desc[..]) = x;
2311
| ^^
2412
|
2513
= note: for more information, see https://github.com/rust-lang/rust/issues/62254
2614
= help: add `#![feature(slice_patterns)]` to the crate attributes to enable
2715

28-
error: aborting due to 4 previous errors
16+
error[E0308]: mismatched types
17+
--> $DIR/pat-lt-bracket-6.rs:9:30
18+
|
19+
LL | const RECOVERY_WITNESS: () = 0;
20+
| ^ expected (), found integer
21+
|
22+
= note: expected type `()`
23+
found type `{integer}`
24+
25+
error: aborting due to 3 previous errors
2926

30-
Some errors have detailed explanations: E0425, E0658.
31-
For more information about an error, try `rustc --explain E0425`.
27+
Some errors have detailed explanations: E0308, E0658.
28+
For more information about an error, try `rustc --explain E0308`.
+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
fn main() {
2-
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
2+
struct Thing(u8, [u8; 0]);
3+
let foo = core::iter::empty();
4+
5+
for Thing(x[]) in foo {} //~ ERROR: expected one of `)`, `,`, or `@`, found `[`
56
}
7+
8+
const RECOVERY_WITNESS: () = 0; //~ ERROR mismatched types
+10-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
error: expected one of `)`, `,`, or `@`, found `[`
2-
--> $DIR/pat-lt-bracket-7.rs:2:16
2+
--> $DIR/pat-lt-bracket-7.rs:5:16
33
|
4-
LL | for thing(x[]) in foo {}
4+
LL | for Thing(x[]) in foo {}
55
| ^ expected one of `)`, `,`, or `@` here
66

7-
error[E0425]: cannot find value `foo` in this scope
8-
--> $DIR/pat-lt-bracket-7.rs:2:23
7+
error[E0308]: mismatched types
8+
--> $DIR/pat-lt-bracket-7.rs:8:30
99
|
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
10+
LL | const RECOVERY_WITNESS: () = 0;
11+
| ^ expected (), found integer
1512
|
16-
LL | for thing(x[]) in foo {}
17-
| ^^^^^ not found in this scope
13+
= note: expected type `()`
14+
found type `{integer}`
1815

19-
error: aborting due to 3 previous errors
16+
error: aborting due to 2 previous errors
2017

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

0 commit comments

Comments
 (0)