Skip to content

Commit c01b3e6

Browse files
committed
block-no-opening-brace: add another statement
1 parent 65b7ba5 commit c01b3e6

File tree

2 files changed

+45
-44
lines changed

2 files changed

+45
-44
lines changed

src/test/ui/parser/block-no-opening-brace.rs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,27 @@
55
fn main() {}
66

77
fn f1() {
8-
loop
9-
let x = 0; //~ ERROR expected `{`, found keyword `let`
10-
}
8+
loop
9+
let x = 0; //~ ERROR expected `{`, found keyword `let`
10+
drop(0);
11+
}
1112

1213
fn f2() {
13-
while true
14-
let x = 0; //~ ERROR expected `{`, found keyword `let`
15-
}
14+
while true
15+
let x = 0; //~ ERROR expected `{`, found keyword `let`
16+
}
1617

1718
fn f3() {
18-
for x in 0..1
19-
let x = 0; //~ ERROR expected `{`, found keyword `let`
20-
}
19+
for x in 0..1
20+
let x = 0; //~ ERROR expected `{`, found keyword `let`
21+
}
2122

2223
fn f4() {
23-
try //~ ERROR expected expression, found reserved keyword `try`
24-
let x = 0;
25-
}
24+
try //~ ERROR expected expression, found reserved keyword `try`
25+
let x = 0;
26+
}
2627

2728
fn f5() {
28-
async //~ ERROR async closures are unstable
29-
let x = 0; //~ ERROR expected one of `move`, `|`, or `||`, found keyword `let`
30-
}
29+
async //~ ERROR async closures are unstable
30+
let x = 0; //~ ERROR expected one of `move`, `|`, or `||`, found keyword `let`
31+
}

src/test/ui/parser/block-no-opening-brace.stderr

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
error: expected `{`, found keyword `let`
2-
--> $DIR/block-no-opening-brace.rs:9:6
2+
--> $DIR/block-no-opening-brace.rs:9:9
33
|
4-
LL | let x = 0;
5-
| ^^^-------
6-
| |
7-
| expected `{`
8-
| help: try placing this code inside a block: `{ let x = 0; }`
4+
LL | let x = 0;
5+
| ^^^-------
6+
| |
7+
| expected `{`
8+
| help: try placing this code inside a block: `{ let x = 0; }`
99

1010
error: expected `{`, found keyword `let`
11-
--> $DIR/block-no-opening-brace.rs:14:6
11+
--> $DIR/block-no-opening-brace.rs:15:9
1212
|
13-
LL | let x = 0;
14-
| ^^^-------
15-
| |
16-
| expected `{`
17-
| help: try placing this code inside a block: `{ let x = 0; }`
13+
LL | let x = 0;
14+
| ^^^-------
15+
| |
16+
| expected `{`
17+
| help: try placing this code inside a block: `{ let x = 0; }`
1818

1919
error: expected `{`, found keyword `let`
20-
--> $DIR/block-no-opening-brace.rs:19:6
20+
--> $DIR/block-no-opening-brace.rs:20:9
2121
|
22-
LL | let x = 0;
23-
| ^^^-------
24-
| |
25-
| expected `{`
26-
| help: try placing this code inside a block: `{ let x = 0; }`
22+
LL | let x = 0;
23+
| ^^^-------
24+
| |
25+
| expected `{`
26+
| help: try placing this code inside a block: `{ let x = 0; }`
2727

2828
error: expected expression, found reserved keyword `try`
29-
--> $DIR/block-no-opening-brace.rs:23:4
29+
--> $DIR/block-no-opening-brace.rs:24:5
3030
|
31-
LL | try
32-
| ^^^ expected expression
31+
LL | try
32+
| ^^^ expected expression
3333

3434
error: expected one of `move`, `|`, or `||`, found keyword `let`
35-
--> $DIR/block-no-opening-brace.rs:29:6
35+
--> $DIR/block-no-opening-brace.rs:30:9
3636
|
37-
LL | async
38-
| - expected one of `move`, `|`, or `||`
39-
LL | let x = 0;
40-
| ^^^ unexpected token
37+
LL | async
38+
| - expected one of `move`, `|`, or `||`
39+
LL | let x = 0;
40+
| ^^^ unexpected token
4141

4242
error[E0658]: async closures are unstable
43-
--> $DIR/block-no-opening-brace.rs:28:4
43+
--> $DIR/block-no-opening-brace.rs:29:5
4444
|
45-
LL | async
46-
| ^^^^^
45+
LL | async
46+
| ^^^^^
4747
|
4848
= note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
4949
= help: add `#![feature(async_closure)]` to the crate attributes to enable

0 commit comments

Comments
 (0)