about summary refs log tree commit diff
path: root/src/libsyntax/util/parser.rs
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-05-15 16:03:22 +0200
committerMazdak Farrokhzad <twingoow@gmail.com>2019-06-23 01:29:29 +0200
commitdff1e379fc55429ea9a4794634e02c17cebee603 (patch)
tree4ec38d68cd0186eebcfba9d20144d43e742a0a74 /src/libsyntax/util/parser.rs
parent3fc964201486f9fdb006bfb7d0caf9b1c3e6cb71 (diff)
downloadrust-dff1e379fc55429ea9a4794634e02c17cebee603.tar.gz
rust-dff1e379fc55429ea9a4794634e02c17cebee603.zip
let_chains: Add support for parsing let expressions.
Diffstat (limited to 'src/libsyntax/util/parser.rs')
-rw-r--r--src/libsyntax/util/parser.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsyntax/util/parser.rs b/src/libsyntax/util/parser.rs
index fcecee8c57f..81b5b085937 100644
--- a/src/libsyntax/util/parser.rs
+++ b/src/libsyntax/util/parser.rs
@@ -260,6 +260,7 @@ pub enum ExprPrecedence {
 
     Box,
     AddrOf,
+    Let,
     Unary,
 
     Call,
@@ -277,9 +278,7 @@ pub enum ExprPrecedence {
     Path,
     Paren,
     If,
-    IfLet,
     While,
-    WhileLet,
     ForLoop,
     Loop,
     Match,
@@ -318,6 +317,8 @@ impl ExprPrecedence {
             // Unary, prefix
             ExprPrecedence::Box |
             ExprPrecedence::AddrOf |
+            // Here `let pats = expr` has `let pats =` as a "unary" prefix of `expr`.
+            ExprPrecedence::Let |
             ExprPrecedence::Unary => PREC_PREFIX,
 
             // Unary, postfix
@@ -338,9 +339,7 @@ impl ExprPrecedence {
             ExprPrecedence::Path |
             ExprPrecedence::Paren |
             ExprPrecedence::If |
-            ExprPrecedence::IfLet |
             ExprPrecedence::While |
-            ExprPrecedence::WhileLet |
             ExprPrecedence::ForLoop |
             ExprPrecedence::Loop |
             ExprPrecedence::Match |