Add more test cases for block-no-opening-brace
This commit is contained in:
parent
8ed95d1d9e
commit
8d2809957e
@ -4,28 +4,46 @@
|
||||
|
||||
fn main() {}
|
||||
|
||||
fn f1() {
|
||||
fn in_loop() {
|
||||
loop
|
||||
let x = 0; //~ ERROR expected `{`, found keyword `let`
|
||||
drop(0);
|
||||
}
|
||||
}
|
||||
|
||||
fn f2() {
|
||||
fn in_while() {
|
||||
while true
|
||||
let x = 0; //~ ERROR expected `{`, found keyword `let`
|
||||
}
|
||||
}
|
||||
|
||||
fn f3() {
|
||||
fn in_for() {
|
||||
for x in 0..1
|
||||
let x = 0; //~ ERROR expected `{`, found keyword `let`
|
||||
}
|
||||
}
|
||||
|
||||
fn f4() {
|
||||
|
||||
// FIXME
|
||||
fn in_try() {
|
||||
try //~ ERROR expected expression, found reserved keyword `try`
|
||||
let x = 0;
|
||||
}
|
||||
}
|
||||
|
||||
fn f5() {
|
||||
// FIXME(#80931)
|
||||
fn in_async() {
|
||||
async
|
||||
let x = 0; //~ ERROR expected one of `move`, `|`, or `||`, found keyword `let`
|
||||
}
|
||||
|
||||
// FIXME(#78168)
|
||||
fn in_const() {
|
||||
let x = const 2; //~ ERROR expected expression, found keyword `const`
|
||||
}
|
||||
|
||||
// FIXME(#78168)
|
||||
fn in_const_in_match() {
|
||||
let x = 2;
|
||||
match x {
|
||||
const 2 => {}
|
||||
//~^ ERROR expected identifier, found keyword `const`
|
||||
//~| ERROR expected one of `=>`, `if`, or `|`, found `2`
|
||||
}
|
||||
}
|
||||
|
@ -38,18 +38,36 @@ LL | { let x = 0; }
|
||||
| + +
|
||||
|
||||
error: expected expression, found reserved keyword `try`
|
||||
--> $DIR/block-no-opening-brace.rs:24:5
|
||||
--> $DIR/block-no-opening-brace.rs:26:5
|
||||
|
|
||||
LL | try
|
||||
| ^^^ expected expression
|
||||
|
||||
error: expected one of `move`, `|`, or `||`, found keyword `let`
|
||||
--> $DIR/block-no-opening-brace.rs:30:9
|
||||
--> $DIR/block-no-opening-brace.rs:33:9
|
||||
|
|
||||
LL | async
|
||||
| - expected one of `move`, `|`, or `||`
|
||||
LL | let x = 0;
|
||||
| ^^^ unexpected token
|
||||
|
||||
error: aborting due to 5 previous errors
|
||||
error: expected expression, found keyword `const`
|
||||
--> $DIR/block-no-opening-brace.rs:38:13
|
||||
|
|
||||
LL | let x = const 2;
|
||||
| ^^^^^ expected expression
|
||||
|
||||
error: expected identifier, found keyword `const`
|
||||
--> $DIR/block-no-opening-brace.rs:45:9
|
||||
|
|
||||
LL | const 2 => {}
|
||||
| ^^^^^ expected identifier, found keyword
|
||||
|
||||
error: expected one of `=>`, `if`, or `|`, found `2`
|
||||
--> $DIR/block-no-opening-brace.rs:45:15
|
||||
|
|
||||
LL | const 2 => {}
|
||||
| ^ expected one of `=>`, `if`, or `|`
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user