-   Notifications  
You must be signed in to change notification settings  - Fork 13.9k
 
Open
Labels
A-grammarArea: The grammar of RustArea: The grammar of RustA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-langRelevant to the language teamRelevant to the language team
Description
These examples should compile according to the rust reference:
fn compiles() -> i32 { ({2}) + ({2}) } fn fails() -> i32 { {2} + {2} } fn compiles2() -> i32 { 2 + {2} } fn fails2() -> i32 { {2} + 2 }Errors:
 Compiling playground v0.0.1 (file:///playground) error: expected expression, found `+` --> src/lib.rs:6:9 | 6 | {2} + {2} | ^ expected expression error: expected expression, found `+` --> src/lib.rs:14:9 | 14 | {2} + 2 | ^ expected expression error: aborting due to 2 previous errors error: Could not compile `playground`. To learn more, run the command again with --verbose. Rust reference snippet (thanks @Moongoodboy-K for the help here):
Expression : BlockExpression | OperatorExpression | ..
OperatorExpression : ArithmeticOrLogicalExpression | ..
ArithmeticOrLogicalExpression : Expression+Expression | ..
BlockExpression :{InnerAttribute* Statement* Expression?}
cc: @Moongoodboy-K
Metadata
Metadata
Assignees
Labels
A-grammarArea: The grammar of RustArea: The grammar of RustA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.T-langRelevant to the language teamRelevant to the language team