1
Fork 0

Rollup merge of #103970 - oli-obk:unhide_unknown_spans, r=estebank

Unhide unknown spans

r? ```@estebank```
This commit is contained in:
Dylan DPC 2022-11-12 12:02:51 +05:30 committed by GitHub
commit fcbe990093
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 121 additions and 69 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;

View file

@ -807,14 +807,16 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> {
err.code(rustc_errors::error_code!(E0411));
err.span_label(span, "`Self` is only available in impls, traits, and type definitions");
if let Some(item_kind) = self.diagnostic_metadata.current_item {
err.span_label(
item_kind.ident.span,
format!(
"`Self` not allowed in {} {}",
item_kind.kind.article(),
item_kind.kind.descr()
),
);
if !item_kind.ident.span.is_dummy() {
err.span_label(
item_kind.ident.span,
format!(
"`Self` not allowed in {} {}",
item_kind.kind.article(),
item_kind.kind.descr()
),
);
}
}
true
}