Skip to content

Commit 895d0b8

Browse files
committed
test
1 parent b92552d commit 895d0b8

File tree

8 files changed

+28
-3
lines changed

8 files changed

+28
-3
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ define_dep_nodes!( <'tcx>
480480
// table in the tcx (or elsewhere) maps to one of these
481481
// nodes.
482482
[] AssociatedItems(DefId),
483+
[] HirQuery(CrateNum),
483484
[] TypeOfItem(DefId),
484485
[] GenericsOfItem(DefId),
485486
[] PredicatesOfItem(DefId),

src/librustc/hir/map/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'hir> Entry<'hir> {
133133

134134
/// Stores a crate and any number of inlined items from other crates.
135135
pub struct Forest {
136-
krate: Crate,
136+
pub(crate) krate: Crate,
137137
pub dep_graph: DepGraph,
138138
}
139139

src/librustc/ich/impls_hir.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ use std::mem;
1111
use syntax::ast;
1212
use syntax::attr;
1313

14+
impl<'a> HashStable<StableHashingContext<'a>> for hir::map::Map<'_> {
15+
#[inline]
16+
fn hash_stable<W: StableHasherResult>(&self,
17+
_hcx: &mut StableHashingContext<'a>,
18+
_hasher: &mut StableHasher<W>) {
19+
}
20+
}
21+
1422
impl<'a> HashStable<StableHashingContext<'a>> for DefId {
1523
#[inline]
1624
fn hash_stable<W: StableHasherResult>(&self,

src/librustc/ty/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ pub struct GlobalCtxt<'tcx> {
957957
/// Export map produced by name resolution.
958958
export_map: FxHashMap<DefId, Lrc<Vec<Export>>>,
959959

960-
hir_map: hir_map::Map<'tcx>,
960+
pub hir_map: hir_map::Map<'tcx>,
961961

962962
/// A map from DefPathHash -> DefId. Includes DefIds from the local crate
963963
/// as well as all upstream crates. Only populated in incremental mode.
@@ -1028,7 +1028,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
10281028

10291029
#[inline(always)]
10301030
pub fn hir(self) -> &'a hir_map::Map<'gcx> {
1031-
&self.hir_map
1031+
self.hir_query(LOCAL_CRATE)
10321032
}
10331033

10341034
pub fn alloc_generics(self, generics: ty::Generics) -> &'gcx ty::Generics {

src/librustc/ty/query/config.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,12 @@ impl<'tcx> QueryDescription<'tcx> for queries::crate_disambiguator<'tcx> {
602602
}
603603
}
604604

605+
impl<'tcx> QueryDescription<'tcx> for queries::hir_query<'tcx> {
606+
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
607+
"hir_query".into()
608+
}
609+
}
610+
605611
impl<'tcx> QueryDescription<'tcx> for queries::crate_hash<'tcx> {
606612
fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> {
607613
"looking up the hash a crate".into()

src/librustc/ty/query/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ pub use self::on_disk_cache::OnDiskCache;
9797
// as they will raise an fatal error on query cycles instead.
9898
define_queries! { <'tcx>
9999
Other {
100+
/// Records the type of every item.
101+
[] fn hir_query: HirQuery(CrateNum) -> &'tcx hir::map::Map<'tcx>,
102+
100103
/// Records the type of every item.
101104
[] fn type_of: TypeOfItem(DefId) -> Ty<'tcx>,
102105

src/librustc/ty/query/plumbing.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,7 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
12631263
DepKind::MirKeys => { force!(mir_keys, LOCAL_CRATE); }
12641264
DepKind::CrateVariances => { force!(crate_variances, LOCAL_CRATE); }
12651265
DepKind::AssociatedItems => { force!(associated_item, def_id!()); }
1266+
DepKind::HirQuery => { force!(hir_query, LOCAL_CRATE); }
12661267
DepKind::TypeOfItem => { force!(type_of, def_id!()); }
12671268
DepKind::GenericsOfItem => { force!(generics_of, def_id!()); }
12681269
DepKind::PredicatesOfItem => { force!(predicates_of, def_id!()); }

src/librustc_typeck/collect.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ pub fn collect_item_types<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
6363

6464
pub fn provide(providers: &mut Providers) {
6565
*providers = Providers {
66+
hir_query,
6667
type_of,
6768
generics_of,
6869
predicates_of,
@@ -1111,6 +1112,11 @@ fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span:
11111112
);
11121113
}
11131114

1115+
fn hir_query<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, _: hir::def_id::CrateNum
1116+
) -> &'tcx hir::map::Map<'tcx> {
1117+
&tcx.hir_map
1118+
}
1119+
11141120
fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> {
11151121
use rustc::hir::*;
11161122

0 commit comments

Comments
 (0)