Skip to content

Commit 8d87ed0

Browse files
committed
Rollup merge of rust-lang#30375 - aaronkeen:issue_28777, r=eddyb
RESTRICTION_STMT_EXPR restriction to allow subsequent expressions to contain braces. rust-lang#28777
2 parents 625da80 + 41cc365 commit 8d87ed0

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,16 +2813,25 @@ impl<'a> Parser<'a> {
28132813

28142814

28152815
let rhs = try!(match op.fixity() {
2816-
Fixity::Right => self.with_res(restrictions, |this|{
2817-
this.parse_assoc_expr_with(op.precedence(), LhsExpr::NotYetParsed)
2816+
Fixity::Right => self.with_res(
2817+
restrictions - Restrictions::RESTRICTION_STMT_EXPR,
2818+
|this| {
2819+
this.parse_assoc_expr_with(op.precedence(),
2820+
LhsExpr::NotYetParsed)
28182821
}),
2819-
Fixity::Left => self.with_res(restrictions, |this|{
2820-
this.parse_assoc_expr_with(op.precedence() + 1, LhsExpr::NotYetParsed)
2822+
Fixity::Left => self.with_res(
2823+
restrictions - Restrictions::RESTRICTION_STMT_EXPR,
2824+
|this| {
2825+
this.parse_assoc_expr_with(op.precedence() + 1,
2826+
LhsExpr::NotYetParsed)
28212827
}),
28222828
// We currently have no non-associative operators that are not handled above by
28232829
// the special cases. The code is here only for future convenience.
2824-
Fixity::None => self.with_res(restrictions, |this|{
2825-
this.parse_assoc_expr_with(op.precedence() + 1, LhsExpr::NotYetParsed)
2830+
Fixity::None => self.with_res(
2831+
restrictions - Restrictions::RESTRICTION_STMT_EXPR,
2832+
|this| {
2833+
this.parse_assoc_expr_with(op.precedence() + 1,
2834+
LhsExpr::NotYetParsed)
28262835
}),
28272836
});
28282837

0 commit comments

Comments
 (0)