@@ -1090,6 +1090,9 @@ impl<'hir> intravisit::Map<'hir> for Map<'hir> {
10901090
10911091pub ( super ) fn crate_hash ( tcx : TyCtxt < ' _ > , crate_num : CrateNum ) -> Svh {
10921092 debug_assert_eq ! ( crate_num, LOCAL_CRATE ) ;
1093+ let krate = tcx. hir_crate ( ( ) ) ;
1094+ let hir_body_hash = krate. hir_hash ;
1095+
10931096 // We hash the final, remapped names of all local source files so we
10941097 // don't have to include the path prefix remapping commandline args.
10951098 // If we included the full mapping in the SVH, we could only have
@@ -1116,14 +1119,27 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
11161119 . collect ( ) ;
11171120 upstream_crates. sort_unstable_by_key ( |& ( stable_crate_id, _) | stable_crate_id) ;
11181121
1119- let mut cfg_opts: Vec < _ > = tcx. sess . parse_sess . config . iter ( ) . collect ( ) ;
1120- cfg_opts. sort_unstable_by_key ( |& ( symbol, _) | symbol. as_str ( ) ) ;
1121-
11221122 let mut hcx = tcx. create_stable_hashing_context ( ) ;
11231123 let mut stable_hasher = StableHasher :: new ( ) ;
1124- source_file_hashes. hash_stable ( & mut hcx, & mut stable_hasher) ;
1125- cfg_opts. hash_stable ( & mut hcx, & mut stable_hasher) ;
1124+ hir_body_hash. hash_stable ( & mut hcx, & mut stable_hasher) ;
11261125 upstream_crates. hash_stable ( & mut hcx, & mut stable_hasher) ;
1126+ source_file_hashes. hash_stable ( & mut hcx, & mut stable_hasher) ;
1127+ if tcx. sess . opts . debugging_opts . incremental_relative_spans {
1128+ let definitions = & tcx. untracked_resolutions . definitions ;
1129+ let mut owner_spans: Vec < _ > = krate
1130+ . owners
1131+ . iter_enumerated ( )
1132+ . filter_map ( |( def_id, info) | {
1133+ let _ = info. as_owner ( ) ?;
1134+ let def_path_hash = definitions. def_path_hash ( def_id) ;
1135+ let span = definitions. def_span ( def_id) ;
1136+ debug_assert_eq ! ( span. parent( ) , None ) ;
1137+ Some ( ( def_path_hash, span) )
1138+ } )
1139+ . collect ( ) ;
1140+ owner_spans. sort_unstable_by_key ( |bn| bn. 0 ) ;
1141+ owner_spans. hash_stable ( & mut hcx, & mut stable_hasher) ;
1142+ }
11271143 tcx. sess . opts . dep_tracking_hash ( true ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
11281144 tcx. sess . local_stable_crate_id ( ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
11291145
0 commit comments