From fab3295cba64a8e4245374c5eb8f2478029d13db Mon Sep 17 00:00:00 2001 From: Ryan Prichard Date: Sun, 5 Apr 2015 18:07:11 -0700 Subject: Suppress the macro backtrace for `fileline_note` and `fileline_help`. --- src/libsyntax/codemap.rs | 2 +- src/libsyntax/diagnostic.rs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 7635c8eadc2..5bbf79d0477 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -871,7 +871,7 @@ impl CodeMap { F: FnOnce(Option<&ExpnInfo>) -> T, { match id { - NO_EXPANSION => f(None), + NO_EXPANSION | COMMAND_LINE_EXPN => f(None), ExpnId(i) => f(Some(&(*self.expansions.borrow())[i as usize])) } } diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index ed7bdcd898e..f3715d765e3 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -465,22 +465,21 @@ fn emit(dst: &mut EmitterWriter, cm: &codemap::CodeMap, rsp: RenderSpan, match rsp { FullSpan(_) => { try!(highlight_lines(dst, cm, sp, lvl, cm.span_to_lines(sp))); + try!(print_macro_backtrace(dst, cm, sp)); } EndSpan(_) => { try!(end_highlight_lines(dst, cm, sp, lvl, cm.span_to_lines(sp))); + try!(print_macro_backtrace(dst, cm, sp)); } Suggestion(_, ref suggestion) => { try!(highlight_suggestion(dst, cm, sp, suggestion)); + try!(print_macro_backtrace(dst, cm, sp)); } FileLine(..) => { // no source text in this case! } } - if sp != COMMAND_LINE_SP { - try!(print_macro_backtrace(dst, cm, sp)); - } - match code { Some(code) => match dst.registry.as_ref().and_then(|registry| registry.find_description(code)) { -- cgit 1.4.1-3-g733a5