1
Fork 0

Print all labels, even if they have no span. Fall back to main item's span.

This commit is contained in:
Oli Scherer 2022-11-04 16:04:47 +00:00
parent 21ce58732b
commit df2adc4760
11 changed files with 110 additions and 51 deletions

View file

@ -241,10 +241,12 @@ impl<'a> Resolver<'a> {
));
err.span_label(span, format!("`{}` re{} here", name, new_participle));
err.span_label(
self.session.source_map().guess_head_span(old_binding.span),
format!("previous {} of the {} `{}` here", old_noun, old_kind, name),
);
if !old_binding.span.is_dummy() && old_binding.span != span {
err.span_label(
self.session.source_map().guess_head_span(old_binding.span),
format!("previous {} of the {} `{}` here", old_noun, old_kind, name),
);
}
// See https://github.com/rust-lang/rust/issues/32354
use NameBindingKind::Import;