@@ -14,7 +14,6 @@ use spans::{CoverageSpan, CoverageSpans};
1414
1515use crate :: MirPass ;
1616
17- use rustc_data_structures:: fingerprint:: Fingerprint ;
1817use rustc_data_structures:: graph:: WithNumNodes ;
1918use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
2019use rustc_data_structures:: sync:: Lrc ;
@@ -29,7 +28,6 @@ use rustc_middle::mir::{
2928 TerminatorKind ,
3029} ;
3130use rustc_middle:: ty:: TyCtxt ;
32- use rustc_query_system:: ich:: StableHashingContext ;
3331use rustc_span:: def_id:: DefId ;
3432use rustc_span:: source_map:: SourceMap ;
3533use rustc_span:: { CharPos , ExpnKind , Pos , SourceFile , Span , Symbol } ;
@@ -574,15 +572,13 @@ fn get_body_span<'tcx>(
574572}
575573
576574fn hash_mir_source < ' tcx > ( tcx : TyCtxt < ' tcx > , hir_body : & ' tcx rustc_hir:: Body < ' tcx > ) -> u64 {
575+ // FIXME(cjgillot) Stop hashing HIR manually here.
577576 let mut hcx = tcx. create_no_span_stable_hashing_context ( ) ;
578- hash ( & mut hcx, & hir_body. value ) . to_smaller_hash ( )
579- }
580-
581- fn hash (
582- hcx : & mut StableHashingContext < ' tcx > ,
583- node : & impl HashStable < StableHashingContext < ' tcx > > ,
584- ) -> Fingerprint {
585577 let mut stable_hasher = StableHasher :: new ( ) ;
586- node. hash_stable ( hcx, & mut stable_hasher) ;
578+ let owner = hir_body. id ( ) . hir_id . owner ;
579+ let bodies = & tcx. hir_owner_nodes ( owner) . as_ref ( ) . unwrap ( ) . bodies ;
580+ hcx. with_hir_bodies ( false , owner, bodies, |hcx| {
581+ hir_body. value . hash_stable ( hcx, & mut stable_hasher)
582+ } ) ;
587583 stable_hasher. finish ( )
588584}
0 commit comments