Skip to content

Commit 6963621

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

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
17+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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[E0423]: expected value, found builtin type `i32`
29+
--> $DIR/array-type-no-semi.rs:7:13
30+
|
31+
LL | let b: [i32, 5];
32+
| ^^^ not a value
33+
34+
error[E0423]: expected value, found builtin type `i32`
35+
--> $DIR/array-type-no-semi.rs:10:13
36+
|
37+
LL | let a: [i32, ];
38+
| ^^^ not a value
39+
40+
error[E0423]: expected value, found builtin type `i32`
41+
--> $DIR/array-type-no-semi.rs:13:13
42+
|
43+
LL | let c: [i32, x];
44+
| ^^^ not a value
45+
46+
error: aborting due to 6 previous errors
47+
48+
For more information about this error, try `rustc --explain E0423`.

0 commit comments

Comments
 (0)