Use DefId in ResolverOutputs::glob_map instead of NodeId

This commit is contained in:
marmeladema 2020-05-20 23:18:45 +01:00
parent 25f575b29f
commit 21f65ae9db
3 changed files with 14 additions and 9 deletions

View File

@ -1134,11 +1134,7 @@ impl<'tcx> TyCtxt<'tcx> {
export_map: resolutions.export_map,
maybe_unused_trait_imports: resolutions.maybe_unused_trait_imports,
maybe_unused_extern_crates: resolutions.maybe_unused_extern_crates,
glob_map: resolutions
.glob_map
.into_iter()
.map(|(id, names)| (definitions.local_def_id(id), names))
.collect(),
glob_map: resolutions.glob_map,
extern_prelude: resolutions.extern_prelude,
untracked_crate: krate,
definitions,

View File

@ -32,7 +32,7 @@ use rustc_hir as hir;
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Namespace, Res};
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LocalDefId, CRATE_DEF_INDEX};
use rustc_hir::lang_items::{FnMutTraitLangItem, FnOnceTraitLangItem, FnTraitLangItem};
use rustc_hir::{Constness, GlobMap, Node};
use rustc_hir::{Constness, Node};
use rustc_index::vec::{Idx, IndexVec};
use rustc_macros::HashStable;
use rustc_serialize::{self, Encodable, Encoder};
@ -126,7 +126,7 @@ pub struct ResolverOutputs {
pub maybe_unused_trait_imports: FxHashSet<LocalDefId>,
pub maybe_unused_extern_crates: Vec<(DefId, Span)>,
pub export_map: ExportMap<hir::HirId>,
pub glob_map: GlobMap,
pub glob_map: FxHashMap<LocalDefId, FxHashSet<Symbol>>,
/// 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<Symbol, bool>,

View File

@ -1308,13 +1308,18 @@ impl<'a> Resolver<'a> {
.into_iter()
.map(|(id, sp)| (definitions.local_def_id(id).to_def_id(), sp))
.collect();
let glob_map = self
.glob_map
.into_iter()
.map(|(id, names)| (definitions.local_def_id(id), names))
.collect();
ResolverOutputs {
definitions: definitions,
cstore: Box::new(self.crate_loader.into_cstore()),
extern_crate_map: self.extern_crate_map,
export_map,
trait_map,
glob_map: self.glob_map,
glob_map,
maybe_unused_trait_imports,
maybe_unused_extern_crates,
extern_prelude: self
@ -1357,7 +1362,11 @@ impl<'a> Resolver<'a> {
}
map
},
glob_map: self.glob_map.clone(),
glob_map: self
.glob_map
.iter()
.map(|(id, names)| (self.definitions.local_def_id(id.clone()), names.clone()))
.collect(),
maybe_unused_trait_imports: self
.maybe_unused_trait_imports
.iter()