@@ -1090,6 +1090,9 @@ impl<'hir> intravisit::Map<'hir> for Map<'hir> {
1090
1090
1091
1091
pub ( super ) fn crate_hash ( tcx : TyCtxt < ' _ > , crate_num : CrateNum ) -> Svh {
1092
1092
debug_assert_eq ! ( crate_num, LOCAL_CRATE ) ;
1093
+ let krate = tcx. hir_crate ( ( ) ) ;
1094
+ let hir_body_hash = krate. hir_hash ;
1095
+
1093
1096
// We hash the final, remapped names of all local source files so we
1094
1097
// don't have to include the path prefix remapping commandline args.
1095
1098
// 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 {
1116
1119
. collect ( ) ;
1117
1120
upstream_crates. sort_unstable_by_key ( |& ( stable_crate_id, _) | stable_crate_id) ;
1118
1121
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
-
1122
1122
let mut hcx = tcx. create_stable_hashing_context ( ) ;
1123
1123
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) ;
1126
1125
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
+ }
1127
1143
tcx. sess . opts . dep_tracking_hash ( true ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1128
1144
tcx. sess . local_stable_crate_id ( ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1129
1145
0 commit comments