about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-12-30 23:20:12 +0000
committerbors <bors@rust-lang.org>2015-12-30 23:20:12 +0000
commit2370d461a648035b54aae492e7df66256f0f18c6 (patch)
tree0576b4d3f134c7eb91e0398795a78811ba5fa52d /src/libsyntax/parse
parent0bd29f8461f75c33be95b706e081cd689bbd32d3 (diff)
parentcedd794d72ee1a9dbf7e55cf66f4a52393066e85 (diff)
downloadrust-2370d461a648035b54aae492e7df66256f0f18c6.tar.gz
rust-2370d461a648035b54aae492e7df66256f0f18c6.zip
Auto merge of #30375 - aaronkeen:issue_28777, r=eddyb
RESTRICTION_STMT_EXPR restriction to allow subsequent expressions to
contain braces.

https://github.com/rust-lang/rust/issues/28777
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 92ece0a2684..a65a6b4a9da 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2809,16 +2809,25 @@ impl<'a> Parser<'a> {
             }
 
             let rhs = try!(match op.fixity() {
-                Fixity::Right => self.with_res(restrictions, |this|{
-                    this.parse_assoc_expr_with(op.precedence(), LhsExpr::NotYetParsed)
+                Fixity::Right => self.with_res(
+                    restrictions - Restrictions::RESTRICTION_STMT_EXPR,
+                    |this| {
+                        this.parse_assoc_expr_with(op.precedence(),
+                            LhsExpr::NotYetParsed)
                 }),
-                Fixity::Left => self.with_res(restrictions, |this|{
-                    this.parse_assoc_expr_with(op.precedence() + 1, LhsExpr::NotYetParsed)
+                Fixity::Left => self.with_res(
+                    restrictions - Restrictions::RESTRICTION_STMT_EXPR,
+                    |this| {
+                        this.parse_assoc_expr_with(op.precedence() + 1,
+                            LhsExpr::NotYetParsed)
                 }),
                 // We currently have no non-associative operators that are not handled above by
                 // the special cases. The code is here only for future convenience.
-                Fixity::None => self.with_res(restrictions, |this|{
-                    this.parse_assoc_expr_with(op.precedence() + 1, LhsExpr::NotYetParsed)
+                Fixity::None => self.with_res(
+                    restrictions - Restrictions::RESTRICTION_STMT_EXPR,
+                    |this| {
+                        this.parse_assoc_expr_with(op.precedence() + 1,
+                            LhsExpr::NotYetParsed)
                 }),
             });