@@ -6,7 +6,7 @@ use rustc_data_structures::svh::Svh;
6
6
use rustc_data_structures:: sync:: { DynSend , DynSync , par_for_each_in, try_par_for_each_in} ;
7
7
use rustc_hir:: def:: { DefKind , Res } ;
8
8
use rustc_hir:: def_id:: { DefId , LOCAL_CRATE , LocalDefId , LocalModDefId } ;
9
- use rustc_hir:: definitions:: { DefKey , DefPath , DefPathHash } ;
9
+ use rustc_hir:: definitions:: { DefKey , DefPath , Definitions } ;
10
10
use rustc_hir:: intravisit:: Visitor ;
11
11
use rustc_hir:: * ;
12
12
use rustc_hir_pretty as pprust_hir;
@@ -193,12 +193,6 @@ impl<'tcx> TyCtxt<'tcx> {
193
193
self . definitions_untracked ( ) . def_path ( def_id)
194
194
}
195
195
196
- #[ inline]
197
- pub fn hir_def_path_hash ( self , def_id : LocalDefId ) -> DefPathHash {
198
- // Accessing the DefPathHash is ok, it is incr. comp. stable.
199
- self . definitions_untracked ( ) . def_path_hash ( def_id)
200
- }
201
-
202
196
pub fn hir_get_if_local ( self , id : DefId ) -> Option < Node < ' tcx > > {
203
197
id. as_local ( ) . map ( |id| self . hir_node_by_def_id ( id) )
204
198
}
@@ -1132,12 +1126,12 @@ impl<'tcx> pprust_hir::PpAnn for TyCtxt<'tcx> {
1132
1126
1133
1127
/// Compute the hash for the HIR of the full crate.
1134
1128
/// This hash will then be part of the crate_hash which is stored in the metadata.
1135
- fn compute_hir_hash ( tcx : TyCtxt < ' _ > ) -> Fingerprint {
1129
+ fn compute_hir_hash ( tcx : TyCtxt < ' _ > , definitions : & Definitions ) -> Fingerprint {
1136
1130
let mut hir_body_nodes: Vec < _ > = tcx
1137
1131
. hir_crate_items ( ( ) )
1138
1132
. owners ( )
1139
1133
. map ( |owner_id| {
1140
- let def_path_hash = tcx . hir_def_path_hash ( owner_id. def_id ) ;
1134
+ let def_path_hash = definitions . def_path_hash ( owner_id. def_id ) ;
1141
1135
let nodes = tcx. opt_hir_owner_nodes ( owner_id) . unwrap ( ) ;
1142
1136
let attrs = tcx. hir_attr_map ( owner_id) ;
1143
1137
let in_scope_traits_map = tcx. in_scope_traits_map ( owner_id) . unwrap ( ) ;
@@ -1154,7 +1148,8 @@ fn compute_hir_hash(tcx: TyCtxt<'_>) -> Fingerprint {
1154
1148
}
1155
1149
1156
1150
pub ( super ) fn crate_hash ( tcx : TyCtxt < ' _ > , _: LocalCrate ) -> Svh {
1157
- let hir_body_hash = compute_hir_hash ( tcx) ;
1151
+ let definitions = tcx. untracked ( ) . definitions . freeze ( ) ;
1152
+ let hir_body_hash = compute_hir_hash ( tcx, definitions) ;
1158
1153
1159
1154
let upstream_crates = upstream_crates ( tcx) ;
1160
1155
@@ -1197,7 +1192,6 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, _: LocalCrate) -> Svh {
1197
1192
source_file_names. hash_stable ( & mut hcx, & mut stable_hasher) ;
1198
1193
debugger_visualizers. hash_stable ( & mut hcx, & mut stable_hasher) ;
1199
1194
if tcx. sess . opts . incremental . is_some ( ) {
1200
- let definitions = tcx. untracked ( ) . definitions . freeze ( ) ;
1201
1195
let mut owner_spans: Vec < _ > = tcx
1202
1196
. hir_crate_items ( ( ) )
1203
1197
. definitions ( )
0 commit comments