block-no-opening-brace: add another statement

This commit is contained in:
Mazdak Farrokhzad 2020-03-07 09:49:46 +01:00
parent 65b7ba5129
commit c01b3e6996
2 changed files with 45 additions and 44 deletions

View File

@ -5,26 +5,27 @@
fn main() {}
fn f1() {
loop
let x = 0; //~ ERROR expected `{`, found keyword `let`
}
loop
let x = 0; //~ ERROR expected `{`, found keyword `let`
drop(0);
}
fn f2() {
while true
let x = 0; //~ ERROR expected `{`, found keyword `let`
}
while true
let x = 0; //~ ERROR expected `{`, found keyword `let`
}
fn f3() {
for x in 0..1
let x = 0; //~ ERROR expected `{`, found keyword `let`
}
for x in 0..1
let x = 0; //~ ERROR expected `{`, found keyword `let`
}
fn f4() {
try //~ ERROR expected expression, found reserved keyword `try`
let x = 0;
}
try //~ ERROR expected expression, found reserved keyword `try`
let x = 0;
}
fn f5() {
async //~ ERROR async closures are unstable
let x = 0; //~ ERROR expected one of `move`, `|`, or `||`, found keyword `let`
}
async //~ ERROR async closures are unstable
let x = 0; //~ ERROR expected one of `move`, `|`, or `||`, found keyword `let`
}

View File

@ -1,49 +1,49 @@
error: expected `{`, found keyword `let`
--> $DIR/block-no-opening-brace.rs:9:6
--> $DIR/block-no-opening-brace.rs:9:9
|
LL | let x = 0;
| ^^^-------
| |
| expected `{`
| help: try placing this code inside a block: `{ let x = 0; }`
LL | let x = 0;
| ^^^-------
| |
| expected `{`
| help: try placing this code inside a block: `{ let x = 0; }`
error: expected `{`, found keyword `let`
--> $DIR/block-no-opening-brace.rs:14:6
--> $DIR/block-no-opening-brace.rs:15:9
|
LL | let x = 0;
| ^^^-------
| |
| expected `{`
| help: try placing this code inside a block: `{ let x = 0; }`
LL | let x = 0;
| ^^^-------
| |
| expected `{`
| help: try placing this code inside a block: `{ let x = 0; }`
error: expected `{`, found keyword `let`
--> $DIR/block-no-opening-brace.rs:19:6
--> $DIR/block-no-opening-brace.rs:20:9
|
LL | let x = 0;
| ^^^-------
| |
| expected `{`
| help: try placing this code inside a block: `{ let x = 0; }`
LL | let x = 0;
| ^^^-------
| |
| expected `{`
| help: try placing this code inside a block: `{ let x = 0; }`
error: expected expression, found reserved keyword `try`
--> $DIR/block-no-opening-brace.rs:23:4
--> $DIR/block-no-opening-brace.rs:24:5
|
LL | try
| ^^^ expected expression
LL | try
| ^^^ expected expression
error: expected one of `move`, `|`, or `||`, found keyword `let`
--> $DIR/block-no-opening-brace.rs:29:6
--> $DIR/block-no-opening-brace.rs:30:9
|
LL | async
| - expected one of `move`, `|`, or `||`
LL | let x = 0;
| ^^^ unexpected token
LL | async
| - expected one of `move`, `|`, or `||`
LL | let x = 0;
| ^^^ unexpected token
error[E0658]: async closures are unstable
--> $DIR/block-no-opening-brace.rs:28:4
--> $DIR/block-no-opening-brace.rs:29:5
|
LL | async
| ^^^^^
LL | async
| ^^^^^
|
= note: see issue #62290 <https://github.com/rust-lang/rust/issues/62290> for more information
= help: add `#![feature(async_closure)]` to the crate attributes to enable