From f38f3af22a4a45c8f4f07be3801a46b27b098a64 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 22 Feb 2023 20:41:51 +0000 Subject: [PATCH] Remove some resolver outputs. --- compiler/rustc_middle/src/query/mod.rs | 3 --- compiler/rustc_middle/src/ty/context.rs | 2 -- compiler/rustc_middle/src/ty/mod.rs | 4 ---- compiler/rustc_resolve/src/check_unused.rs | 1 - compiler/rustc_resolve/src/lib.rs | 9 --------- 5 files changed, 19 deletions(-) diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 6a34e5ede19..0981ba83adf 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1830,9 +1830,6 @@ rustc_queries! { query maybe_unused_trait_imports(_: ()) -> &'tcx FxIndexSet { desc { "fetching potentially unused trait imports" } } - query maybe_unused_extern_crates(_: ()) -> &'tcx [(LocalDefId, Span)] { - desc { "looking up all possibly unused extern crates" } - } query names_imported_by_glob_use(def_id: LocalDefId) -> &'tcx FxHashSet { desc { |tcx| "finding names imported by glob use for `{}`", tcx.def_path_str(def_id.to_def_id()) } } diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 7e6a6e71670..e46a3416f57 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -2504,8 +2504,6 @@ pub fn provide(providers: &mut ty::query::Providers) { |tcx, id| tcx.resolutions(()).reexport_map.get(&id).map(|v| &v[..]); providers.maybe_unused_trait_imports = |tcx, ()| &tcx.resolutions(()).maybe_unused_trait_imports; - providers.maybe_unused_extern_crates = - |tcx, ()| &tcx.resolutions(()).maybe_unused_extern_crates[..]; providers.names_imported_by_glob_use = |tcx, id| { tcx.arena.alloc(tcx.resolutions(()).glob_map.get(&id).cloned().unwrap_or_default()) }; diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index f61fe707ac9..3995884f808 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -168,12 +168,8 @@ pub struct ResolverGlobalCtxt { pub effective_visibilities: EffectiveVisibilities, pub extern_crate_map: FxHashMap, pub maybe_unused_trait_imports: FxIndexSet, - pub maybe_unused_extern_crates: Vec<(LocalDefId, Span)>, pub reexport_map: FxHashMap>, pub glob_map: FxHashMap>, - /// Extern prelude entries. The value is `true` if the entry was introduced - /// via `extern crate` item and not `--extern` option or compiler built-in. - pub extern_prelude: FxHashMap, pub main_def: Option, pub trait_impls: FxIndexMap>, /// A list of proc macro LocalDefIds, written out in the order in which diff --git a/compiler/rustc_resolve/src/check_unused.rs b/compiler/rustc_resolve/src/check_unused.rs index 88a809293fa..df7f91c5a27 100644 --- a/compiler/rustc_resolve/src/check_unused.rs +++ b/compiler/rustc_resolve/src/check_unused.rs @@ -278,7 +278,6 @@ impl Resolver<'_, '_> { } ImportKind::ExternCrate { id, .. } => { let def_id = self.local_def_id(id); - self.maybe_unused_extern_crates.push((def_id, import.span)); if self.extern_crate_map.get(&def_id).map_or(true, |&cnum| { !tcx.is_compiler_builtins(cnum) && !tcx.is_panic_runtime(cnum) diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index 237ddd0f761..57c40a5b23e 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -946,7 +946,6 @@ pub struct Resolver<'a, 'tcx> { has_pub_restricted: bool, used_imports: FxHashSet, maybe_unused_trait_imports: FxIndexSet, - maybe_unused_extern_crates: Vec<(LocalDefId, Span)>, /// Privacy errors are delayed until the end in order to deduplicate them. privacy_errors: Vec>, @@ -1284,7 +1283,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { has_pub_restricted: false, used_imports: FxHashSet::default(), maybe_unused_trait_imports: Default::default(), - maybe_unused_extern_crates: Vec::new(), privacy_errors: Vec::new(), ambiguity_errors: Vec::new(), @@ -1400,7 +1398,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { let extern_crate_map = self.extern_crate_map; let reexport_map = self.reexport_map; let maybe_unused_trait_imports = self.maybe_unused_trait_imports; - let maybe_unused_extern_crates = self.maybe_unused_extern_crates; let glob_map = self.glob_map; let main_def = self.main_def; let confused_type_with_std_module = self.confused_type_with_std_module; @@ -1414,12 +1411,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { reexport_map, glob_map, maybe_unused_trait_imports, - maybe_unused_extern_crates, - extern_prelude: self - .extern_prelude - .iter() - .map(|(ident, entry)| (ident.name, entry.introduced_by_item)) - .collect(), main_def, trait_impls: self.trait_impls, proc_macros,