`{ expr1 } || expr2;` logical or / closure ambiguity
Open
@BartSimpson001 is already working on this.
Since Jan 1, 2026.
A-diagnostics
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Code
fn main() {
{ false } || { true };
}
Current output
error[E0308]: mismatched types
--> src/main.rs:2:7
|
2 | { false } || { true };
| ^^^^^ expected `()`, found `bool`
For more information about this error, try `rustc --explain E0308`.
Desired output
help: parentheses are required to parse this as an expression
|
2 | ({ false } || { true });
help: use `if` instead
|
2 | if !{ false } { { true }; }
Rationale and extra context
Probably something left out by #60188
Other cases
Rust Version
rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: x86_64-unknown-linux-gnu
release: 1.92.0
LLVM version: 21.1.3
Anything else?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.