@@ -6,7 +6,7 @@ use rustc_data_structures::svh::Svh;
66use rustc_data_structures:: sync:: { DynSend , DynSync , par_for_each_in, try_par_for_each_in} ;
77use rustc_hir:: def:: { DefKind , Res } ;
88use 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 } ;
1010use rustc_hir:: intravisit:: Visitor ;
1111use rustc_hir:: * ;
1212use rustc_hir_pretty as pprust_hir;
@@ -193,12 +193,6 @@ impl<'tcx> TyCtxt<'tcx> {
193193 self . definitions_untracked ( ) . def_path ( def_id)
194194 }
195195
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-
202196 pub fn hir_get_if_local ( self , id : DefId ) -> Option < Node < ' tcx > > {
203197 id. as_local ( ) . map ( |id| self . hir_node_by_def_id ( id) )
204198 }
@@ -1132,12 +1126,12 @@ impl<'tcx> pprust_hir::PpAnn for TyCtxt<'tcx> {
11321126
11331127/// Compute the hash for the HIR of the full crate.
11341128/// 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 {
11361130 let mut hir_body_nodes: Vec < _ > = tcx
11371131 . hir_crate_items ( ( ) )
11381132 . owners ( )
11391133 . 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 ) ;
11411135 let nodes = tcx. opt_hir_owner_nodes ( owner_id) . unwrap ( ) ;
11421136 let attrs = tcx. hir_attr_map ( owner_id) ;
11431137 let in_scope_traits_map = tcx. in_scope_traits_map ( owner_id) . unwrap ( ) ;
@@ -1154,7 +1148,8 @@ fn compute_hir_hash(tcx: TyCtxt<'_>) -> Fingerprint {
11541148}
11551149
11561150pub ( 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) ;
11581153
11591154 let upstream_crates = upstream_crates ( tcx) ;
11601155
@@ -1197,7 +1192,6 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, _: LocalCrate) -> Svh {
11971192 source_file_names. hash_stable ( & mut hcx, & mut stable_hasher) ;
11981193 debugger_visualizers. hash_stable ( & mut hcx, & mut stable_hasher) ;
11991194 if tcx. sess . opts . incremental . is_some ( ) {
1200- let definitions = tcx. untracked ( ) . definitions . freeze ( ) ;
12011195 let mut owner_spans: Vec < _ > = tcx
12021196 . hir_crate_items ( ( ) )
12031197 . definitions ( )
0 commit comments