]> git.lizzy.rs Git - rust.git/commitdiff
Moves expand_stmt's bt_pop so that it balances correctly.
authorChristopher Chambers <chris.chambers@peanutcode.com>
Sat, 11 Apr 2015 05:59:00 +0000 (00:59 -0500)
committerChristopher Chambers <chris.chambers@peanutcode.com>
Sat, 11 Apr 2015 05:59:00 +0000 (00:59 -0500)
src/libsyntax/ext/expand.rs

index 8e6b5f85440b9c18683add52820385514e975d2c..8aa6acaeec2c33838aeadff80fdd36982669539a 100644 (file)
@@ -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.