about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorChristopher Chambers <chris.chambers@peanutcode.com>2015-04-11 00:59:00 -0500
committerChristopher Chambers <chris.chambers@peanutcode.com>2015-04-11 00:59:00 -0500
commit77627ea8dd3b310d02138647363e72fdd024bb6c (patch)
tree599c1164a10414e2c4fbcd8e53bfeccd44743a66 /src/libsyntax
parent22eb3193a62fa01e97bf53d5f5aa74ca8ea57a67 (diff)
downloadrust-77627ea8dd3b310d02138647363e72fdd024bb6c.tar.gz
rust-77627ea8dd3b310d02138647363e72fdd024bb6c.zip
Moves expand_stmt's bt_pop so that it balances correctly.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ext/expand.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 8e6b5f85440..8aa6acaeec2 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -761,13 +761,14 @@ fn expand_stmt(stmt: P<Stmt>, fld: &mut MacroExpander) -> SmallVector<P<Stmt>> {
     let mut fully_expanded = match maybe_new_items {
         Some(stmts) => {
             // Keep going, outside-in.
-            stmts.into_iter().flat_map(|s| {
+            let new_items = stmts.into_iter().flat_map(|s| {
                 fld.fold_stmt(s).into_iter()
-            }).collect()
+            }).collect();
+            fld.cx.bt_pop();
+            new_items
         }
         None => SmallVector::zero()
     };
-    fld.cx.bt_pop();
 
     // If this is a macro invocation with a semicolon, then apply that
     // semicolon to the final statement produced by expansion.