about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-25 22:36:23 -0700
committerbors <bors@rust-lang.org>2014-05-25 22:36:23 -0700
commita7ab73344dcf3bf0973317ae165f751f6bb42766 (patch)
treeebf4a2434095f757481f02e9766d6afebda2ce6c /src/libsyntax
parent20a41519fd92c50c44132870a95415159a1d09ea (diff)
parentff0f9b62f64cea6474e93667f93b91c05e3be57f (diff)
downloadrust-a7ab73344dcf3bf0973317ae165f751f6bb42766.tar.gz
rust-a7ab73344dcf3bf0973317ae165f751f6bb42766.zip
auto merge of #14432 : kballard/rust/nt_block, r=huonw
Fixes #13678.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/parser.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index bfdf0361f05..ae5f16c2580 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -135,17 +135,21 @@ at INTERPOLATED tokens */
 macro_rules! maybe_whole_expr (
     ($p:expr) => (
         {
-            let mut maybe_path = match ($p).token {
-                INTERPOLATED(token::NtPath(ref pt)) => Some((**pt).clone()),
-                _ => None,
-            };
-            let found = match ($p).token {
+            let found = match $p.token {
                 INTERPOLATED(token::NtExpr(e)) => {
                     Some(e)
                 }
                 INTERPOLATED(token::NtPath(_)) => {
-                    let pt = maybe_path.take_unwrap();
-                    Some($p.mk_expr(($p).span.lo, ($p).span.hi, ExprPath(pt)))
+                    // FIXME: The following avoids an issue with lexical borrowck scopes,
+                    // but the clone is unfortunate.
+                    let pt = match $p.token {
+                        INTERPOLATED(token::NtPath(ref pt)) => (**pt).clone(),
+                        _ => unreachable!()
+                    };
+                    Some($p.mk_expr($p.span.lo, $p.span.hi, ExprPath(pt)))
+                }
+                INTERPOLATED(token::NtBlock(b)) => {
+                    Some($p.mk_expr($p.span.lo, $p.span.hi, ExprBlock(b)))
                 }
                 _ => None
             };