Supress unhelpful diagnostics for unresolved top level attributes
This commit is contained in:
parent
0ea334ab73
commit
492df34eea
30 changed files with 100 additions and 202 deletions
|
@ -5,8 +5,10 @@
|
|||
//! item.
|
||||
|
||||
use crate::{errors, fluent_generated as fluent};
|
||||
use rustc_ast::{ast, AttrStyle, Attribute, LitKind, MetaItemKind, MetaItemLit, NestedMetaItem};
|
||||
use rustc_ast::{ast, AttrKind, AttrStyle, Attribute, LitKind};
|
||||
use rustc_ast::{MetaItemKind, MetaItemLit, NestedMetaItem};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_errors::StashKey;
|
||||
use rustc_errors::{Applicability, DiagCtxt, IntoDiagnosticArg, MultiSpan};
|
||||
use rustc_feature::{AttributeDuplicates, AttributeType, BuiltinAttribute, BUILTIN_ATTRIBUTE_MAP};
|
||||
use rustc_hir as hir;
|
||||
|
@ -2530,6 +2532,14 @@ fn check_invalid_crate_level_attr(tcx: TyCtxt<'_>, attrs: &[Attribute]) {
|
|||
if attr.style == AttrStyle::Inner {
|
||||
for attr_to_check in ATTRS_TO_CHECK {
|
||||
if attr.has_name(*attr_to_check) {
|
||||
if let AttrKind::Normal(ref p) = attr.kind
|
||||
&& let Some(diag) = tcx.dcx().steal_diagnostic(
|
||||
p.item.path.span,
|
||||
StashKey::UndeterminedMacroResolution,
|
||||
)
|
||||
{
|
||||
diag.cancel();
|
||||
}
|
||||
let item = tcx
|
||||
.hir()
|
||||
.items()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue