]> git.lizzy.rs Git - rust.git/commitdiff
Corrects issue #28777 by removing, once a binary operator is found, the
authorAaron Keen <aaronkeen@gmail.com>
Mon, 14 Dec 2015 20:32:16 +0000 (21:32 +0100)
committerAaron Keen <aaronkeen@gmail.com>
Mon, 14 Dec 2015 20:32:16 +0000 (21:32 +0100)
RESTRICTION_STMT_EXPR restriction to allow subsequent expressions to
contain braces.

https://github.com/rust-lang/rust/issues/28777

src/libsyntax/parse/parser.rs

index 7502a8cbc35466156a00ce3238eeb1d2e9519133..6cbdd9f341118cb3e40816cd8c678f98658c6118 100644 (file)
@@ -2813,16 +2813,25 @@ pub fn parse_assoc_expr_with(&mut self,
 
 
             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)
                 }),
             });