Add macro call span when lacking any other span in diagnostic

This commit is contained in:
Esteban Küber 2018-10-23 10:07:11 -07:00
parent a66dc8a148
commit 8544db0faa
4 changed files with 32 additions and 1 deletions

View file

@ -612,6 +612,17 @@ impl MultiSpan {
&self.primary_spans
}
/// Returns `true` if this contains only a dummy primary span with any hygienic context.
pub fn is_dummy(&self) -> bool {
let mut is_dummy = true;
for span in &self.primary_spans {
if !span.is_dummy() {
is_dummy = false;
}
}
is_dummy
}
/// Replaces all occurrences of one Span with another. Used to move Spans in areas that don't
/// display well (like std macros). Returns true if replacements occurred.
pub fn replace(&mut self, before: Span, after: Span) -> bool {