rust/tests/ui/parser/else-no-if.stderr
David Tolnay aedc1b6ad4
Remove MacCall special case from recovery after missing 'if' after 'else'
The change to the test is a little goofy because the compiler was
guessing "correctly" before that `falsy! {}` is the condition as opposed
to the else body. But I believe this change is fundamentally correct.
Braced macro invocations in statement position are most often item-like
(`thread_local! {...}`) as opposed to parenthesized macro invocations
which are condition-like (`cfg!(...)`).
2024-05-11 15:49:51 -07:00

97 lines
2.2 KiB
Plaintext

error: expected `{`, found keyword `false`
--> $DIR/else-no-if.rs:7:12
|
LL | } else false {
| ---- ^^^^^
| |
| 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 false {
| ++
error: expected `{`, found `falsy`
--> $DIR/else-no-if.rs:14: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:21:12
|
LL | } else falsy();
| ^^^^^ expected `{`
|
help: try placing this code inside a block
|
LL | } else { falsy() };
| + +
error: expected `{`, found keyword `loop`
--> $DIR/else-no-if.rs:27:12
|
LL | } else loop{}
| ^^^^ expected `{`
|
help: try placing this code inside a block
|
LL | } else { loop{} }
| + +
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 `{`
|
help: try placing this code inside a block
|
LL | } else { 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