@@ -969,22 +969,12 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
969969 . iter_enumerated ( )
970970 . filter_map ( |( def_id, hod) | {
971971 let def_path_hash = tcx. untracked_resolutions . definitions . def_path_hash ( def_id) ;
972- let mut hasher = StableHasher :: new ( ) ;
973- hod. as_ref ( ) ?. hash_stable ( & mut hcx, & mut hasher) ;
974- AttributeMap { map : & tcx. untracked_crate . attrs , prefix : def_id }
975- . hash_stable ( & mut hcx, & mut hasher) ;
976- Some ( ( def_path_hash, hasher. finish ( ) ) )
972+ let hash = hod. as_ref ( ) ?. hash ;
973+ Some ( ( def_path_hash, hash, def_id) )
977974 } )
978975 . collect ( ) ;
979976 hir_body_nodes. sort_unstable_by_key ( |bn| bn. 0 ) ;
980977
981- let node_hashes = hir_body_nodes. iter ( ) . fold (
982- Fingerprint :: ZERO ,
983- |combined_fingerprint, & ( def_path_hash, fingerprint) | {
984- combined_fingerprint. combine ( def_path_hash. 0 . combine ( fingerprint) )
985- } ,
986- ) ;
987-
988978 let upstream_crates = upstream_crates ( tcx) ;
989979
990980 // We hash the final, remapped names of all local source files so we
@@ -1004,7 +994,17 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
1004994 source_file_names. sort_unstable ( ) ;
1005995
1006996 let mut stable_hasher = StableHasher :: new ( ) ;
1007- node_hashes. hash_stable ( & mut hcx, & mut stable_hasher) ;
997+ for ( def_path_hash, fingerprint, def_id) in hir_body_nodes. iter ( ) {
998+ def_path_hash. 0 . hash_stable ( & mut hcx, & mut stable_hasher) ;
999+ fingerprint. hash_stable ( & mut hcx, & mut stable_hasher) ;
1000+ AttributeMap { map : & tcx. untracked_crate . attrs , prefix : * def_id }
1001+ . hash_stable ( & mut hcx, & mut stable_hasher) ;
1002+ if tcx. sess . opts . debugging_opts . incremental_relative_spans {
1003+ let span = tcx. untracked_resolutions . definitions . def_span ( * def_id) ;
1004+ debug_assert_eq ! ( span. parent( ) , None ) ;
1005+ span. hash_stable ( & mut hcx, & mut stable_hasher) ;
1006+ }
1007+ }
10081008 upstream_crates. hash_stable ( & mut hcx, & mut stable_hasher) ;
10091009 source_file_names. hash_stable ( & mut hcx, & mut stable_hasher) ;
10101010 tcx. sess . opts . dep_tracking_hash ( true ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
0 commit comments