diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-30 18:54:40 +0200 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-10-30 18:54:40 +0200 |
| commit | c17f89d6ede71cb0f8f0286307b1b83a642aff91 (patch) | |
| tree | 66666d0fd2591bf4b71db78b53356f14f3ac13ec /src/libsyntax_expand | |
| parent | 0b7e28a1610924a27471ffdb59a2885709b3b415 (diff) | |
caller_location: point to macro invocation sites, like file!/line!.
Diffstat (limited to 'src/libsyntax_expand')
| -rw-r--r-- | src/libsyntax_expand/base.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/libsyntax_expand/base.rs b/src/libsyntax_expand/base.rs index a66263a9a02..e8be57dfd4c 100644 --- a/src/libsyntax_expand/base.rs +++ b/src/libsyntax_expand/base.rs @@ -954,18 +954,7 @@ impl<'a> ExtCtxt<'a> { /// /// Stops backtracing at include! boundary. pub fn expansion_cause(&self) -> Option<Span> { - let mut expn_id = self.current_expansion.id; - let mut last_macro = None; - loop { - let expn_data = expn_id.expn_data(); - // Stop going up the backtrace once include! is encountered - if expn_data.is_root() || expn_data.kind.descr() == sym::include { - break; - } - expn_id = expn_data.call_site.ctxt().outer_expn(); - last_macro = Some(expn_data.call_site); - } - last_macro + self.current_expansion.id.expansion_cause() } pub fn struct_span_warn<S: Into<MultiSpan>>(&self, |
