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
17 changed files with 121 additions and 69 deletions

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
}