Skip to content

Commit 84cb4ad

Browse files
committed
Fix a bug where macros in expression position don't have expansion inidices in their spans
1 parent 8ac0bce commit 84cb4ad

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/libsyntax/ext/expand.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
6060
};
6161

6262
// Keep going, outside-in.
63-
//
6463
let fully_expanded = fld.fold_expr(expanded_expr);
64+
let span = fld.new_span(span);
6565
fld.cx.bt_pop();
6666

6767
fully_expanded.map(|e| ast::Expr {
6868
id: ast::DUMMY_NODE_ID,
6969
node: e.node,
70-
span: fld.new_span(span),
70+
span: span,
7171
})
7272
}
7373

@@ -367,7 +367,8 @@ pub fn expand_expr(e: P<ast::Expr>, fld: &mut MacroExpander) -> P<ast::Expr> {
367367
/// of expansion and the mark which must be applied to the result.
368368
/// Our current interface doesn't allow us to apply the mark to the
369369
/// result until after calling make_expr, make_items, etc.
370-
fn expand_mac_invoc<T, F, G>(mac: ast::Mac, span: codemap::Span,
370+
fn expand_mac_invoc<T, F, G>(mac: ast::Mac,
371+
span: codemap::Span,
371372
parse_thunk: F,
372373
mark_thunk: G,
373374
fld: &mut MacroExpander)

0 commit comments

Comments
 (0)