Skip to content

Commit

Permalink
Print the file in which a macro was defined
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-schievink committed Sep 14, 2015
1 parent f3308b9 commit 0be755c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/libsyntax/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,11 +742,20 @@ impl EmitterWriter {
// 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),

let mut diag_string = format!("in this expansion of {}{}{}",
pre,
ei.callee.name(),
post);

if let Some(def_site_span) = ei.callee.span {
diag_string.push_str(&format!(" (defined in {})",
cm.span_to_filename(def_site_span)));
}

try!(self.print_diagnostic(&cm.span_to_string(ei.call_site),
Note,
&diag_string,
None));
}
Ok(Some(ei.call_site))
Expand Down

0 comments on commit 0be755c

Please sign in to comment.