Skip to content

Commit 1cac8cb

Browse files
committed
Add test array-type-no-semi.rs
Signed-off-by: xizheyin <[email protected]>
1 parent 7e310f4 commit 1cac8cb

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// when the next token is not a semicolon,
2+
// we should suggest to use semicolon if recovery is allowed
3+
// See issue #143828
4+
5+
fn main() {
6+
let x = 5;
7+
let b: [i32, 5];
8+
//~^ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `,`
9+
//~| ERROR expected value, found builtin type `i32` [E0423]
10+
let a: [i32, ];
11+
//~^ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `,`
12+
//~| ERROR expected value, found builtin type `i32` [E0423]
13+
let c: [i32, x];
14+
//~^ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `,`
15+
//~| ERROR expected value, found builtin type `i32` [E0423]
16+
let e: [i32 5];
17+
//~^ ERROR expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `5`
18+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `,`
2+
--> $DIR/array-type-no-semi.rs:7:16
3+
|
4+
LL | let b: [i32, 5];
5+
| - ^ expected one of 7 possible tokens
6+
| |
7+
| while parsing the type for `b`
8+
| help: use `=` if you meant to assign
9+
10+
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `,`
11+
--> $DIR/array-type-no-semi.rs:10:16
12+
|
13+
LL | let a: [i32, ];
14+
| - ^ expected one of 7 possible tokens
15+
| |
16+
| while parsing the type for `a`
17+
| help: use `=` if you meant to assign
18+
19+
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `,`
20+
--> $DIR/array-type-no-semi.rs:13:16
21+
|
22+
LL | let c: [i32, x];
23+
| - ^ expected one of 7 possible tokens
24+
| |
25+
| while parsing the type for `c`
26+
| help: use `=` if you meant to assign
27+
28+
error: expected one of `!`, `(`, `+`, `::`, `;`, `<`, or `]`, found `5`
29+
--> $DIR/array-type-no-semi.rs:16:17
30+
|
31+
LL | let e: [i32 5];
32+
| - ^ expected one of 7 possible tokens
33+
| |
34+
| while parsing the type for `e`
35+
36+
error[E0423]: expected value, found builtin type `i32`
37+
--> $DIR/array-type-no-semi.rs:7:13
38+
|
39+
LL | let b: [i32, 5];
40+
| ^^^ not a value
41+
42+
error[E0423]: expected value, found builtin type `i32`
43+
--> $DIR/array-type-no-semi.rs:10:13
44+
|
45+
LL | let a: [i32, ];
46+
| ^^^ not a value
47+
48+
error[E0423]: expected value, found builtin type `i32`
49+
--> $DIR/array-type-no-semi.rs:13:13
50+
|
51+
LL | let c: [i32, x];
52+
| ^^^ not a value
53+
54+
error: aborting due to 7 previous errors
55+
56+
For more information about this error, try `rustc --explain E0423`.

0 commit comments

Comments
 (0)