@@ -218,13 +218,6 @@ impl<'hir> Map<'hir> {
218
218
self . tcx . local_def_id_to_hir_id ( def_id)
219
219
}
220
220
221
- pub fn iter_local_def_id ( self ) -> impl Iterator < Item = LocalDefId > + ' hir {
222
- // Create a dependency to the crate to be sure we re-execute this when the amount of
223
- // definitions change.
224
- self . tcx . ensure ( ) . hir_crate ( ( ) ) ;
225
- self . tcx . definitions_untracked ( ) . iter_local_def_id ( )
226
- }
227
-
228
221
/// Do not call this function directly. The query should be called.
229
222
pub ( super ) fn opt_def_kind ( self , local_def_id : LocalDefId ) -> Option < DefKind > {
230
223
let hir_id = self . local_def_id_to_hir_id ( local_def_id) ;
@@ -1141,34 +1134,35 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
1141
1134
1142
1135
source_file_names. sort_unstable ( ) ;
1143
1136
1144
- let mut hcx = tcx. create_stable_hashing_context ( ) ;
1145
- let mut stable_hasher = StableHasher :: new ( ) ;
1146
- hir_body_hash. hash_stable ( & mut hcx, & mut stable_hasher) ;
1147
- upstream_crates. hash_stable ( & mut hcx, & mut stable_hasher) ;
1148
- source_file_names. hash_stable ( & mut hcx, & mut stable_hasher) ;
1149
- if tcx. sess . opts . debugging_opts . incremental_relative_spans {
1150
- let definitions = & tcx. definitions_untracked ( ) ;
1151
- let mut owner_spans: Vec < _ > = krate
1152
- . owners
1153
- . iter_enumerated ( )
1154
- . filter_map ( |( def_id, info) | {
1155
- let _ = info. as_owner ( ) ?;
1156
- let def_path_hash = definitions. def_path_hash ( def_id) ;
1157
- let span = resolutions. source_span [ def_id] ;
1158
- debug_assert_eq ! ( span. parent( ) , None ) ;
1159
- Some ( ( def_path_hash, span) )
1160
- } )
1161
- . collect ( ) ;
1162
- owner_spans. sort_unstable_by_key ( |bn| bn. 0 ) ;
1163
- owner_spans. hash_stable ( & mut hcx, & mut stable_hasher) ;
1164
- }
1165
- tcx. sess . opts . dep_tracking_hash ( true ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1166
- tcx. sess . local_stable_crate_id ( ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1167
- // Hash visibility information since it does not appear in HIR.
1168
- resolutions. visibilities . hash_stable ( & mut hcx, & mut stable_hasher) ;
1169
- resolutions. has_pub_restricted . hash_stable ( & mut hcx, & mut stable_hasher) ;
1137
+ let crate_hash: Fingerprint = tcx. with_stable_hashing_context ( |mut hcx| {
1138
+ let mut stable_hasher = StableHasher :: new ( ) ;
1139
+ hir_body_hash. hash_stable ( & mut hcx, & mut stable_hasher) ;
1140
+ upstream_crates. hash_stable ( & mut hcx, & mut stable_hasher) ;
1141
+ source_file_names. hash_stable ( & mut hcx, & mut stable_hasher) ;
1142
+ if tcx. sess . opts . debugging_opts . incremental_relative_spans {
1143
+ let definitions = tcx. definitions_untracked ( ) ;
1144
+ let mut owner_spans: Vec < _ > = krate
1145
+ . owners
1146
+ . iter_enumerated ( )
1147
+ . filter_map ( |( def_id, info) | {
1148
+ let _ = info. as_owner ( ) ?;
1149
+ let def_path_hash = definitions. def_path_hash ( def_id) ;
1150
+ let span = resolutions. source_span [ def_id] ;
1151
+ debug_assert_eq ! ( span. parent( ) , None ) ;
1152
+ Some ( ( def_path_hash, span) )
1153
+ } )
1154
+ . collect ( ) ;
1155
+ owner_spans. sort_unstable_by_key ( |bn| bn. 0 ) ;
1156
+ owner_spans. hash_stable ( & mut hcx, & mut stable_hasher) ;
1157
+ }
1158
+ tcx. sess . opts . dep_tracking_hash ( true ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1159
+ tcx. sess . local_stable_crate_id ( ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1160
+ // Hash visibility information since it does not appear in HIR.
1161
+ resolutions. visibilities . hash_stable ( & mut hcx, & mut stable_hasher) ;
1162
+ resolutions. has_pub_restricted . hash_stable ( & mut hcx, & mut stable_hasher) ;
1163
+ stable_hasher. finish ( )
1164
+ } ) ;
1170
1165
1171
- let crate_hash: Fingerprint = stable_hasher. finish ( ) ;
1172
1166
Svh :: new ( crate_hash. to_smaller_hash ( ) )
1173
1167
}
1174
1168
0 commit comments