mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Add macro calls to else-no-if parser test
This commit is contained in:
parent
728e117166
commit
0f6a51d495
@ -1,3 +1,7 @@
|
||||
macro_rules! falsy {
|
||||
() => { false };
|
||||
}
|
||||
|
||||
fn foo() {
|
||||
if true {
|
||||
} else false {
|
||||
@ -25,6 +29,32 @@ fn foo4() {
|
||||
{}
|
||||
}
|
||||
|
||||
fn foo5() {
|
||||
if true {
|
||||
} else falsy!() {
|
||||
//~^ ERROR expected `{`, found `falsy`
|
||||
}
|
||||
}
|
||||
|
||||
fn foo6() {
|
||||
if true {
|
||||
} else falsy!();
|
||||
//~^ ERROR expected `{`, found `falsy`
|
||||
}
|
||||
|
||||
fn foo7() {
|
||||
if true {
|
||||
} else falsy! {} {
|
||||
//~^ ERROR expected `{`, found `falsy`
|
||||
}
|
||||
}
|
||||
|
||||
fn foo8() {
|
||||
if true {
|
||||
} else falsy! {};
|
||||
//~^ ERROR expected `{`, found `falsy`
|
||||
}
|
||||
|
||||
fn falsy() -> bool {
|
||||
false
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
error: expected `{`, found keyword `false`
|
||||
--> $DIR/else-no-if.rs:3:12
|
||||
--> $DIR/else-no-if.rs:7:12
|
||||
|
|
||||
LL | } else false {
|
||||
| ---- ^^^^^
|
||||
@ -12,7 +12,7 @@ LL | } else if false {
|
||||
| ++
|
||||
|
||||
error: expected `{`, found `falsy`
|
||||
--> $DIR/else-no-if.rs:10:12
|
||||
--> $DIR/else-no-if.rs:14:12
|
||||
|
|
||||
LL | } else falsy() {
|
||||
| ---- ^^^^^
|
||||
@ -25,7 +25,7 @@ LL | } else if falsy() {
|
||||
| ++
|
||||
|
||||
error: expected `{`, found `falsy`
|
||||
--> $DIR/else-no-if.rs:17:12
|
||||
--> $DIR/else-no-if.rs:21:12
|
||||
|
|
||||
LL | } else falsy();
|
||||
| ^^^^^ expected `{`
|
||||
@ -36,7 +36,7 @@ LL | } else { falsy() };
|
||||
| + +
|
||||
|
||||
error: expected `{`, found keyword `loop`
|
||||
--> $DIR/else-no-if.rs:23:12
|
||||
--> $DIR/else-no-if.rs:27:12
|
||||
|
|
||||
LL | } else loop{}
|
||||
| ^^^^ expected `{`
|
||||
@ -46,5 +46,53 @@ help: try placing this code inside a block
|
||||
LL | } else { loop{} }
|
||||
| + +
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: expected `{`, found `falsy`
|
||||
--> $DIR/else-no-if.rs:34:12
|
||||
|
|
||||
LL | } else falsy!() {
|
||||
| ---- ^^^^^
|
||||
| |
|
||||
| expected an `if` or a block after this `else`
|
||||
|
|
||||
help: add an `if` if this is the condition of a chained `else if` statement
|
||||
|
|
||||
LL | } else if falsy!() {
|
||||
| ++
|
||||
|
||||
error: expected `{`, found `falsy`
|
||||
--> $DIR/else-no-if.rs:41:12
|
||||
|
|
||||
LL | } else falsy!();
|
||||
| ^^^^^ expected `{`
|
||||
|
|
||||
help: try placing this code inside a block
|
||||
|
|
||||
LL | } else { falsy!() };
|
||||
| + +
|
||||
|
||||
error: expected `{`, found `falsy`
|
||||
--> $DIR/else-no-if.rs:47:12
|
||||
|
|
||||
LL | } else falsy! {} {
|
||||
| ---- ^^^^^
|
||||
| |
|
||||
| expected an `if` or a block after this `else`
|
||||
|
|
||||
help: add an `if` if this is the condition of a chained `else if` statement
|
||||
|
|
||||
LL | } else if falsy! {} {
|
||||
| ++
|
||||
|
||||
error: expected `{`, found `falsy`
|
||||
--> $DIR/else-no-if.rs:54:12
|
||||
|
|
||||
LL | } else falsy! {};
|
||||
| ^^^^^ expected `{`
|
||||
|
|
||||
help: try placing this code inside a block
|
||||
|
|
||||
LL | } else { falsy! {} };
|
||||
| + +
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user