Skip to content

Commit 513e326

Browse files
committed
Add a hir_krate query
1 parent 63980cd commit 513e326

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

src/librustc/hir/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@ impl<'tcx> TyCtxt<'tcx> {
4141
}
4242

4343
pub fn provide(providers: &mut Providers<'_>) {
44+
providers.hir_crate = |tcx, _| tcx.hir_map.forest.untracked_krate();
4445
map::provide(providers);
4546
}

src/librustc/query/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ rustc_queries! {
4343
}
4444

4545
Other {
46+
query hir_crate(key: CrateNum) -> &'tcx Crate<'tcx> {
47+
eval_always
48+
no_hash
49+
desc { "get the crate HIR" }
50+
}
51+
4652
/// Records the type of every item.
4753
query type_of(key: DefId) -> Ty<'tcx> {
4854
cache_on_disk_if { key.is_local() }

src/librustc/ty/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use rustc_data_structures::sync::Lrc;
4545
use rustc_hir as hir;
4646
use rustc_hir::def::DefKind;
4747
use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, DefIndex};
48-
use rustc_hir::{HirIdSet, ItemLocalId, TraitCandidate};
48+
use rustc_hir::{Crate, HirIdSet, ItemLocalId, TraitCandidate};
4949
use rustc_index::vec::IndexVec;
5050
use rustc_target::spec::PanicStrategy;
5151

0 commit comments

Comments
 (0)