Separate Definitions and CrateStore from ResolverOutputs.
This commit is contained in:
parent
1f34da9ec8
commit
47799de35a
8 changed files with 72 additions and 75 deletions
|
@ -7,7 +7,7 @@ pub mod nested_filter;
|
|||
pub mod place;
|
||||
|
||||
use crate::ty::query::Providers;
|
||||
use crate::ty::{ImplSubject, TyCtxt};
|
||||
use crate::ty::{DefIdTree, ImplSubject, TyCtxt};
|
||||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
|
@ -104,23 +104,20 @@ pub fn provide(providers: &mut Providers) {
|
|||
};
|
||||
providers.hir_owner_nodes = |tcx, id| tcx.hir_crate(()).owners[id].map(|i| &i.nodes);
|
||||
providers.hir_owner_parent = |tcx, id| {
|
||||
// Accessing the def_key is ok since its value is hashed as part of `id`'s DefPathHash.
|
||||
let parent = tcx.untracked_resolutions.definitions.def_key(id).parent;
|
||||
let parent = parent.map_or(CRATE_HIR_ID, |local_def_index| {
|
||||
let def_id = LocalDefId { local_def_index };
|
||||
let mut parent_hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
// Accessing the local_parent is ok since its value is hashed as part of `id`'s DefPathHash.
|
||||
tcx.opt_local_parent(id).map_or(CRATE_HIR_ID, |parent| {
|
||||
let mut parent_hir_id = tcx.hir().local_def_id_to_hir_id(parent);
|
||||
if let Some(local_id) =
|
||||
tcx.hir_crate(()).owners[parent_hir_id.owner].unwrap().parenting.get(&id)
|
||||
{
|
||||
parent_hir_id.local_id = *local_id;
|
||||
}
|
||||
parent_hir_id
|
||||
});
|
||||
parent
|
||||
})
|
||||
};
|
||||
providers.hir_attrs =
|
||||
|tcx, id| tcx.hir_crate(()).owners[id].as_owner().map_or(AttributeMap::EMPTY, |o| &o.attrs);
|
||||
providers.source_span = |tcx, def_id| tcx.resolutions(()).definitions.def_span(def_id);
|
||||
providers.source_span = |tcx, def_id| tcx.definitions_untracked().def_span(def_id);
|
||||
providers.def_span = |tcx, def_id| {
|
||||
let def_id = def_id.expect_local();
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
|
@ -150,7 +147,7 @@ pub fn provide(providers: &mut Providers) {
|
|||
providers.all_local_trait_impls = |tcx, ()| &tcx.resolutions(()).trait_impls;
|
||||
providers.expn_that_defined = |tcx, id| {
|
||||
let id = id.expect_local();
|
||||
tcx.resolutions(()).definitions.expansion_that_defined(id)
|
||||
tcx.definitions_untracked().expansion_that_defined(id)
|
||||
};
|
||||
providers.in_scope_traits_map =
|
||||
|tcx, id| tcx.hir_crate(()).owners[id].as_owner().map(|owner_info| &owner_info.trait_map);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue