rustc_lint_defs: Eliminate the dependency on rustc_hir for Namespace
`rustc_lint_defs` uses `rustc_hir` solely for the `Namespace` type, which it only needs the static description from. Use the static description directly, to eliminate the dependency on `rustc_hir`. This reduces a long dependency chain: - Many things depend on `rustc_errors` - `rustc_errors` depends on `rustc_lint_defs` - `rustc_lint_defs` depended on `rustc_hir` prior to this commit - `rustc_hir` depends on `rustc_target`
This commit is contained in:
@@ -4139,7 +4139,6 @@ dependencies = [
|
||||
"rustc_ast",
|
||||
"rustc_data_structures",
|
||||
"rustc_error_messages",
|
||||
"rustc_hir",
|
||||
"rustc_hir_id",
|
||||
"rustc_macros",
|
||||
"rustc_serialize",
|
||||
|
||||
@@ -732,7 +732,7 @@ lint_pattern_in_foreign = patterns aren't allowed in foreign function declaratio
|
||||
lint_private_extern_crate_reexport = extern crate `{$ident}` is private and cannot be re-exported
|
||||
.suggestion = consider making the `extern crate` item publicly accessible
|
||||
|
||||
lint_proc_macro_derive_resolution_fallback = cannot find {$ns} `{$ident}` in this scope
|
||||
lint_proc_macro_derive_resolution_fallback = cannot find {$ns_descr} `{$ident}` in this scope
|
||||
.label = names from parent modules are not accessible without an explicit import
|
||||
|
||||
lint_query_instability = using `{$query}` can result in unstable query results
|
||||
|
||||
@@ -64,10 +64,12 @@ pub fn decorate_builtin_lint(
|
||||
}
|
||||
.decorate_lint(diag);
|
||||
}
|
||||
BuiltinLintDiag::ProcMacroDeriveResolutionFallback { span: macro_span, ns, ident } => {
|
||||
lints::ProcMacroDeriveResolutionFallback { span: macro_span, ns, ident }
|
||||
.decorate_lint(diag)
|
||||
}
|
||||
BuiltinLintDiag::ProcMacroDeriveResolutionFallback {
|
||||
span: macro_span,
|
||||
ns_descr,
|
||||
ident,
|
||||
} => lints::ProcMacroDeriveResolutionFallback { span: macro_span, ns_descr, ident }
|
||||
.decorate_lint(diag),
|
||||
BuiltinLintDiag::MacroExpandedMacroExportsAccessedByAbsolutePaths(span_def) => {
|
||||
lints::MacroExpandedMacroExportsAccessedByAbsolutePaths { definition: span_def }
|
||||
.decorate_lint(diag)
|
||||
|
||||
@@ -8,7 +8,6 @@ use rustc_errors::{
|
||||
EmissionGuarantee, LintDiagnostic, MultiSpan, Subdiagnostic, SuggestionStyle,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Namespace;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::intravisit::VisitorExt;
|
||||
use rustc_macros::{LintDiagnostic, Subdiagnostic};
|
||||
@@ -2769,7 +2768,7 @@ pub(crate) struct AbsPathWithModuleSugg {
|
||||
pub(crate) struct ProcMacroDeriveResolutionFallback {
|
||||
#[label]
|
||||
pub span: Span,
|
||||
pub ns: Namespace,
|
||||
pub ns_descr: &'static str,
|
||||
pub ident: Ident,
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ rustc_abi = { path = "../rustc_abi" }
|
||||
rustc_ast = { path = "../rustc_ast" }
|
||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||
rustc_error_messages = { path = "../rustc_error_messages" }
|
||||
rustc_hir = { path = "../rustc_hir" }
|
||||
rustc_hir_id = { path = "../rustc_hir_id" }
|
||||
rustc_macros = { path = "../rustc_macros" }
|
||||
rustc_serialize = { path = "../rustc_serialize" }
|
||||
|
||||
@@ -9,7 +9,6 @@ use rustc_data_structures::stable_hasher::{
|
||||
HashStable, StableCompare, StableHasher, ToStableHashKey,
|
||||
};
|
||||
use rustc_error_messages::{DiagArgValue, DiagMessage, IntoDiagArg, MultiSpan};
|
||||
use rustc_hir::def::Namespace;
|
||||
use rustc_hir_id::{HashStableContext, HirId, ItemLocalId};
|
||||
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
|
||||
use rustc_span::def_id::DefPathHash;
|
||||
@@ -625,7 +624,7 @@ pub enum BuiltinLintDiag {
|
||||
AbsPathWithModule(Span),
|
||||
ProcMacroDeriveResolutionFallback {
|
||||
span: Span,
|
||||
ns: Namespace,
|
||||
ns_descr: &'static str,
|
||||
ident: Ident,
|
||||
},
|
||||
MacroExpandedMacroExportsAccessedByAbsolutePaths(Span),
|
||||
|
||||
@@ -528,7 +528,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||
orig_ident.span,
|
||||
BuiltinLintDiag::ProcMacroDeriveResolutionFallback {
|
||||
span: orig_ident.span,
|
||||
ns,
|
||||
ns_descr: ns.descr(),
|
||||
ident,
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user