Open
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