Skip to content

Commit

Permalink
Don't print duplicate macro backtrace frames
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-schievink committed Sep 11, 2015
1 parent 31fa44b commit f3308b9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/libsyntax/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,9 @@ impl EmitterWriter {
cm: &codemap::CodeMap,
sp: Span)
-> io::Result<()> {
let mut last_span = codemap::DUMMY_SP;
let mut sp_opt = Some(sp);

while let Some(sp) = sp_opt {
sp_opt = try!(cm.with_expn_info(sp.expn_id, |expn_info| -> io::Result<_> {
match expn_info {
Expand All @@ -737,12 +739,16 @@ impl EmitterWriter {
codemap::MacroBang(..) => ("", "!"),
codemap::CompilerExpansion(..) => ("", ""),
};
try!(self.print_diagnostic(&cm.span_to_string(ei.call_site), Note,
&format!("in this expansion of {}{}{}",
pre,
ei.callee.name(),
post),
None));
// Don't print recursive invocations
if ei.call_site != last_span {
last_span = ei.call_site;
try!(self.print_diagnostic(&cm.span_to_string(ei.call_site), Note,
&format!("in this expansion of {}{}{}",
pre,
ei.callee.name(),
post),
None));
}
Ok(Some(ei.call_site))
}
None => Ok(None)
Expand Down

0 comments on commit f3308b9

Please sign in to comment.