@@ -215,13 +215,6 @@ impl<'hir> Map<'hir> {
215
215
self . tcx . local_def_id_to_hir_id ( def_id)
216
216
}
217
217
218
- pub fn iter_local_def_id ( self ) -> impl Iterator < Item = LocalDefId > + ' hir {
219
- // Create a dependency to the crate to be sure we re-execute this when the amount of
220
- // definitions change.
221
- self . tcx . ensure ( ) . hir_crate ( ( ) ) ;
222
- self . tcx . definitions_untracked ( ) . iter_local_def_id ( )
223
- }
224
-
225
218
pub fn opt_def_kind ( self , local_def_id : LocalDefId ) -> Option < DefKind > {
226
219
let hir_id = self . local_def_id_to_hir_id ( local_def_id) ;
227
220
let def_kind = match self . find ( hir_id) ? {
@@ -1098,35 +1091,36 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
1098
1091
1099
1092
source_file_names. sort_unstable ( ) ;
1100
1093
1101
- let mut hcx = tcx. create_stable_hashing_context ( ) ;
1102
- let mut stable_hasher = StableHasher :: new ( ) ;
1103
- hir_body_hash. hash_stable ( & mut hcx, & mut stable_hasher) ;
1104
- upstream_crates. hash_stable ( & mut hcx, & mut stable_hasher) ;
1105
- source_file_names. hash_stable ( & mut hcx, & mut stable_hasher) ;
1106
- if tcx. sess . opts . debugging_opts . incremental_relative_spans {
1107
- let definitions = & tcx. definitions_untracked ( ) ;
1108
- let mut owner_spans: Vec < _ > = krate
1109
- . owners
1110
- . iter_enumerated ( )
1111
- . filter_map ( |( def_id, info) | {
1112
- let _ = info. as_owner ( ) ?;
1113
- let def_path_hash = definitions. def_path_hash ( def_id) ;
1114
- let span = definitions. def_span ( def_id) ;
1115
- debug_assert_eq ! ( span. parent( ) , None ) ;
1116
- Some ( ( def_path_hash, span) )
1117
- } )
1118
- . collect ( ) ;
1119
- owner_spans. sort_unstable_by_key ( |bn| bn. 0 ) ;
1120
- owner_spans. hash_stable ( & mut hcx, & mut stable_hasher) ;
1121
- }
1122
- tcx. sess . opts . dep_tracking_hash ( true ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1123
- tcx. sess . local_stable_crate_id ( ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1124
- // Hash visibility information since it does not appear in HIR.
1125
- let resolutions = tcx. resolutions ( ( ) ) ;
1126
- resolutions. visibilities . hash_stable ( & mut hcx, & mut stable_hasher) ;
1127
- resolutions. has_pub_restricted . hash_stable ( & mut hcx, & mut stable_hasher) ;
1128
-
1129
- let crate_hash: Fingerprint = stable_hasher. finish ( ) ;
1094
+ let crate_hash: Fingerprint = tcx. with_stable_hashing_context ( |mut hcx| {
1095
+ let mut stable_hasher = StableHasher :: new ( ) ;
1096
+ hir_body_hash. hash_stable ( & mut hcx, & mut stable_hasher) ;
1097
+ upstream_crates. hash_stable ( & mut hcx, & mut stable_hasher) ;
1098
+ source_file_names. hash_stable ( & mut hcx, & mut stable_hasher) ;
1099
+ if tcx. sess . opts . debugging_opts . incremental_relative_spans {
1100
+ let definitions = tcx. definitions_untracked ( ) ;
1101
+ let mut owner_spans: Vec < _ > = krate
1102
+ . owners
1103
+ . iter_enumerated ( )
1104
+ . filter_map ( |( def_id, info) | {
1105
+ let _ = info. as_owner ( ) ?;
1106
+ let def_path_hash = definitions. def_path_hash ( def_id) ;
1107
+ let span = definitions. def_span ( def_id) ;
1108
+ debug_assert_eq ! ( span. parent( ) , None ) ;
1109
+ Some ( ( def_path_hash, span) )
1110
+ } )
1111
+ . collect ( ) ;
1112
+ owner_spans. sort_unstable_by_key ( |bn| bn. 0 ) ;
1113
+ owner_spans. hash_stable ( & mut hcx, & mut stable_hasher) ;
1114
+ }
1115
+ tcx. sess . opts . dep_tracking_hash ( true ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1116
+ tcx. sess . local_stable_crate_id ( ) . hash_stable ( & mut hcx, & mut stable_hasher) ;
1117
+ // Hash visibility information since it does not appear in HIR.
1118
+ let resolutions = tcx. resolutions ( ( ) ) ;
1119
+ resolutions. visibilities . hash_stable ( & mut hcx, & mut stable_hasher) ;
1120
+ resolutions. has_pub_restricted . hash_stable ( & mut hcx, & mut stable_hasher) ;
1121
+ stable_hasher. finish ( )
1122
+ } ) ;
1123
+
1130
1124
Svh :: new ( crate_hash. to_smaller_hash ( ) )
1131
1125
}
1132
1126
0 commit comments