rust/tests/ui/missing/missing-let.stderr
Usman Akinyemi 85ca098f55 rustc_parse: improve the error diagnostic for "missing let"
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
2026-02-07 22:12:04 +05:30

42 lines
1.1 KiB
Text

error: expected expression, found `let` statement
--> $DIR/missing-let.rs:5:8
|
LL | if let Some(_) = x
| ^^^^^^^^^^^^^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
help: you might have meant to continue the let-chain
|
LL | && let Some(x) = x
| +++
help: you might have meant to compare for equality
|
LL | && Some(x) == x
| +
error: expected expression, found `let` statement
--> $DIR/missing-let.rs:13:9
|
LL | let Some(_) = z
| ^^^
|
= note: only supported directly in conditions of `if` and `while` expressions
error: let-chain with missing `let`
--> $DIR/missing-let.rs:10:8
|
LL | if Some(_) = y &&
| ^^^^^^^----
| |
| expected `let` expression, found assignment
...
LL | let Some(_) = z
| --------------- let expression later in the condition
|
help: add `let` before the expression
|
LL | if let Some(_) = y &&
| +++
error: aborting due to 3 previous errors