Skip to content

Commit 4259fba

Browse files
committed
Fix macro call site spans
1 parent 8b012ed commit 4259fba

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

src/libsyntax/ext/base.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -602,22 +602,6 @@ impl<'a> ExtCtxt<'a> {
602602
}
603603
pub fn backtrace(&self) -> ExpnId { self.backtrace }
604604

605-
/// Original span that caused the current exapnsion to happen.
606-
pub fn original_span(&self) -> Span {
607-
let mut expn_id = self.backtrace;
608-
let mut call_site = None;
609-
loop {
610-
match self.codemap().with_expn_info(expn_id, |ei| ei.map(|ei| ei.call_site)) {
611-
None => break,
612-
Some(cs) => {
613-
call_site = Some(cs);
614-
expn_id = cs.expn_id;
615-
}
616-
}
617-
}
618-
call_site.expect("missing expansion backtrace")
619-
}
620-
621605
/// Returns span for the macro which originally caused the current expansion to happen.
622606
///
623607
/// Stops backtracing at include! boundary.

src/libsyntax/ext/expand.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,8 @@ fn expand_mac_invoc<T>(mac: ast::Mac, ident: Option<Ident>, attrs: Vec<ast::Attr
237237
},
238238
});
239239

240-
// The span that we pass to the expanders we want to
241-
// be the root of the call stack. That's the most
242-
// relevant span and it's the actual invocation of
243-
// the macro.
244-
let mac_span = fld.cx.original_span();
245-
246240
let marked_tts = mark_tts(&tts[..], mark);
247-
Some(expandfun.expand(fld.cx, mac_span, &marked_tts))
241+
Some(expandfun.expand(fld.cx, call_site, &marked_tts))
248242
}
249243

250244
IdentTT(ref expander, tt_span, allow_internal_unstable) => {

0 commit comments

Comments
 (0)