Add a `hir_krate` query

This commit is contained in:
John Kåre Alsaker 2020-02-06 12:16:51 +01:00
parent 63980cd0fb
commit 513e326f5b
3 changed files with 8 additions and 1 deletions

View File

@ -41,5 +41,6 @@ impl<'tcx> TyCtxt<'tcx> {
}
pub fn provide(providers: &mut Providers<'_>) {
providers.hir_crate = |tcx, _| tcx.hir_map.forest.untracked_krate();
map::provide(providers);
}

View File

@ -43,6 +43,12 @@ rustc_queries! {
}
Other {
query hir_crate(key: CrateNum) -> &'tcx Crate<'tcx> {
eval_always
no_hash
desc { "get the crate HIR" }
}
/// Records the type of every item.
query type_of(key: DefId) -> Ty<'tcx> {
cache_on_disk_if { key.is_local() }

View File

@ -45,7 +45,7 @@ use rustc_data_structures::sync::Lrc;
use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex};
use rustc_hir::{HirIdSet, ItemLocalId, TraitCandidate};
use rustc_hir::{Crate, HirIdSet, ItemLocalId, TraitCandidate};
use rustc_index::vec::IndexVec;
use rustc_target::spec::PanicStrategy;