rust/tests/ui/parser/bad-let-else-statement.stderr
GearsDatapacks 1fc6dbc32b Change expr_trailing_brace to an exhaustive match to force new expression kinds to specify whether they contain a brace
Add inline const and other possible curly brace expressions to expr_trailing_brace

Add tests for `}` before `else` in `let...else` error

Change to explicit cases for expressions with optional values when being checked for trailing braces

Add tests for more complex cases of `}` before `else` in `let..else` statement

Move other possible `}` cases into separate arm and add FIXME for future reference
2023-12-14 18:11:18 +00:00

233 lines
5.2 KiB
Plaintext

error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:9:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = ({
LL | 1
LL ~ }) else {
|
error: `for...else` loops are not supported
--> $DIR/bad-let-else-statement.rs:18:7
|
LL | let foo = for i in 1..2 {
| --- `else` is attached to this loop
LL | break;
LL | } else {
| _______^
LL | |
LL | | return;
LL | | };
| |_____^
|
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:29:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = (if true {
LL | 1
LL | } else {
LL | 0
LL ~ }) else {
|
error: `loop...else` loops are not supported
--> $DIR/bad-let-else-statement.rs:38:7
|
LL | let foo = loop {
| ---- `else` is attached to this loop
LL | break;
LL | } else {
| _______^
LL | |
LL | | return;
LL | | };
| |_____^
|
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:48:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = (match true {
LL | true => 1,
LL | false => 0
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:58:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = (X {
LL | a: 1
LL ~ }) else {
|
error: `while...else` loops are not supported
--> $DIR/bad-let-else-statement.rs:67:7
|
LL | let foo = while false {
| ----- `else` is attached to this loop
LL | break;
LL | } else {
| _______^
LL | |
LL | | return;
LL | | };
| |_____^
|
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:76:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = (const {
LL | 1
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:85:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = &({
LL | 1
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:95:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = bar = ({
LL | 1
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:104:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = 1 + ({
LL | 1
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:113:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = 1..({
LL | 1
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:122:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = return ({
LL | ()
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:131:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = -({
LL | 1
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:140:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = do yeet ({
LL | ()
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:149:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = become ({
LL | ()
LL ~ }) else {
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
--> $DIR/bad-let-else-statement.rs:158:5
|
LL | } else {
| ^
|
help: wrap the expression in parentheses
|
LL ~ let foo = |x: i32| ({
LL | x
LL ~ }) else {
|
error: aborting due to 17 previous errors