Closed
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!");
}