]> git.lizzy.rs Git - rust.git/commitdiff
Fix a bug where macros in expression position don't have expansion inidices in their...
authorNick Cameron <ncameron@mozilla.com>
Wed, 8 Jul 2015 02:29:43 +0000 (14:29 +1200)
committerNick Cameron <ncameron@mozilla.com>
Thu, 9 Jul 2015 00:24:39 +0000 (12:24 +1200)
src/libsyntax/ext/expand.rs

index 4aa313f3e660ff4165a0434439101740332ca546..a4855ddcb25d26f32e1338f4d2d71a803e881ce8 100644 (file)
@@ -60,14 +60,14 @@ fn push_compiler_expansion(fld: &mut MacroExpander, span: Span, expansion_desc:
             };
 
             // Keep going, outside-in.
-            //
             let fully_expanded = fld.fold_expr(expanded_expr);
+            let span = fld.new_span(span); 
             fld.cx.bt_pop();
 
             fully_expanded.map(|e| ast::Expr {
                 id: ast::DUMMY_NODE_ID,
                 node: e.node,
-                span: fld.new_span(span),
+                span: span,
             })
         }
 
@@ -367,7 +367,8 @@ fn push_compiler_expansion(fld: &mut MacroExpander, span: Span, expansion_desc:
 /// of expansion and the mark which must be applied to the result.
 /// Our current interface doesn't allow us to apply the mark to the
 /// result until after calling make_expr, make_items, etc.
-fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span,
+fn expand_mac_invoc<T, F, G>(mac: ast::Mac,
+                             span: codemap::Span,
                              parse_thunk: F,
                              mark_thunk: G,
                              fld: &mut MacroExpander)