-
Notifications
You must be signed in to change notification settings - Fork 13.9k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
fn main() {
if let x = 1 && 2 {}
}
Current output
error[E0308]: mismatched types
--> src/main.rs:2:21
|
2 | if let x = 1 && 2 {}
| --------- ^ expected `bool`, found integer
| |
| expected because this is `bool`
For more information about this error, try `rustc --explain E0308`.
error: could not compile `playground` (bin "playground") due to 1 previous error
Desired output
Rationale and extra context
The compiler is saying that let x = 1
has type bool
, which doesn't make much sense.
Other cases
Rust Version
Reproducible on the playground with version: 1.92.0-nightly (2025-10-13 4b94758d2ba7d0ef71cc)
Anything else?
Discovered by ashtree129 on the community discord.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.