@@ -14,7 +14,6 @@ use spans::{CoverageSpan, CoverageSpans};
14
14
15
15
use crate :: MirPass ;
16
16
17
- use rustc_data_structures:: fingerprint:: Fingerprint ;
18
17
use rustc_data_structures:: graph:: WithNumNodes ;
19
18
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
20
19
use rustc_data_structures:: sync:: Lrc ;
@@ -29,7 +28,6 @@ use rustc_middle::mir::{
29
28
TerminatorKind ,
30
29
} ;
31
30
use rustc_middle:: ty:: TyCtxt ;
32
- use rustc_query_system:: ich:: StableHashingContext ;
33
31
use rustc_span:: def_id:: DefId ;
34
32
use rustc_span:: source_map:: SourceMap ;
35
33
use rustc_span:: { CharPos , ExpnKind , Pos , SourceFile , Span , Symbol } ;
@@ -574,15 +572,13 @@ fn get_body_span<'tcx>(
574
572
}
575
573
576
574
fn hash_mir_source < ' tcx > ( tcx : TyCtxt < ' tcx > , hir_body : & ' tcx rustc_hir:: Body < ' tcx > ) -> u64 {
575
+ // FIXME(cjgillot) Stop hashing HIR manually here.
577
576
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 {
585
577
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
+ } ) ;
587
583
stable_hasher. finish ( )
588
584
}
0 commit comments