-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an AST
Description
There seems to be an ambiguity in the syntax for both if and if let. This is due to the fact that expressions can contain { ... } and this looks like a branches of the if-statement. For example, the rust compiler fails to parse the following two examples:
fn main() {
struct S { x: i32, y: i32 }
#[derive(PartialEq)]
struct T {}
// Example 1:
if let S { x: _x, y: 2 } = S { x: 1, y: 2 } { println!("Ok"); }
// Example 2:
if T {} == T {} { println!("Ok"); }
println!("Hello, world!");
}
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an AST