diff options
| author | bors <bors@rust-lang.org> | 2013-09-14 12:30:54 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-14 12:30:54 -0700 |
| commit | 524c190565c0dbafdb7f27bc3c27c0952f32c2f9 (patch) | |
| tree | 7c0bc39e3de938085f0ab2c01670e941edd3e971 /src/libsyntax | |
| parent | bca015d9ffd94c36fc8e1b4f30727f71e5ce579f (diff) | |
| parent | 6c4c5f56313b3b48dc42297ca927f2a43715e19f (diff) | |
| download | rust-524c190565c0dbafdb7f27bc3c27c0952f32c2f9.tar.gz rust-524c190565c0dbafdb7f27bc3c27c0952f32c2f9.zip | |
auto merge of #9183 : alexcrichton/rust/issue-5794, r=catamorphism
Closes #5794
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index f7e58c14db0..0c8986fc6d7 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -76,8 +76,26 @@ pub fn expand_expr(extsbox: @mut SyntaxEnv, // mark before: let marked_before = mark_tts(*tts,fm); let marked_ctxt = new_mark(fm, ctxt); + + // The span that we pass to the expanders we want to + // be the root of the call stack. That's the most + // relevant span and it's the actual invocation of + // the macro. + let mut relevant_info = cx.backtrace(); + let mut einfo = relevant_info.unwrap(); + loop { + match relevant_info { + None => { break } + Some(e) => { + einfo = e; + relevant_info = einfo.call_site.expn_info; + } + } + } + let expanded = - match expandfun(cx, mac.span, marked_before, marked_ctxt) { + match expandfun(cx, einfo.call_site, + marked_before, marked_ctxt) { MRExpr(e) => e, MRAny(expr_maker,_,_) => expr_maker(), _ => { |
