@@ -10,7 +10,6 @@ use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
10
10
use rustc_hir:: intravisit:: Visitor ;
11
11
use rustc_hir:: * ;
12
12
use rustc_hir_pretty as pprust_hir;
13
- use rustc_index:: IndexSlice ;
14
13
use rustc_span:: def_id:: StableCrateId ;
15
14
use rustc_span:: { ErrorGuaranteed , Ident , Span , Symbol , kw, sym, with_metavar_spans} ;
16
15
@@ -1133,16 +1132,16 @@ impl<'tcx> pprust_hir::PpAnn for TyCtxt<'tcx> {
1133
1132
1134
1133
/// Compute the hash for the HIR of the full crate.
1135
1134
/// This hash will then be part of the crate_hash which is stored in the metadata.
1136
- fn compute_hir_hash (
1137
- tcx : TyCtxt < ' _ > ,
1138
- owners : & IndexSlice < LocalDefId , MaybeOwner < ' _ > > ,
1139
- ) -> Fingerprint {
1140
- let mut hir_body_nodes : Vec < _ > = owners
1141
- . iter_enumerated ( )
1142
- . filter_map ( | ( def_id , info ) | {
1143
- let info = info . as_owner ( ) ? ;
1144
- let def_path_hash = tcx. hir_def_path_hash ( def_id ) ;
1145
- Some ( ( def_path_hash, info ) )
1135
+ fn compute_hir_hash ( tcx : TyCtxt < ' _ > ) -> Fingerprint {
1136
+ let mut hir_body_nodes : Vec < _ > = tcx
1137
+ . hir_crate_items ( ( ) )
1138
+ . owners ( )
1139
+ . map ( |owner_id| {
1140
+ let def_path_hash = tcx . hir_def_path_hash ( owner_id . def_id ) ;
1141
+ let nodes = tcx . opt_hir_owner_nodes ( owner_id ) . unwrap ( ) ;
1142
+ let attrs = tcx . hir_attr_map ( owner_id ) ;
1143
+ let in_scope_traits_map = tcx. in_scope_traits_map ( owner_id ) . unwrap ( ) ;
1144
+ ( def_path_hash, nodes , attrs , in_scope_traits_map )
1146
1145
} )
1147
1146
. collect ( ) ;
1148
1147
hir_body_nodes. sort_unstable_by_key ( |bn| bn. 0 ) ;
@@ -1155,8 +1154,7 @@ fn compute_hir_hash(
1155
1154
}
1156
1155
1157
1156
pub ( super ) fn crate_hash ( tcx : TyCtxt < ' _ > , _: LocalCrate ) -> Svh {
1158
- let krate = tcx. hir_crate ( ( ) ) ;
1159
- let hir_body_hash = compute_hir_hash ( tcx, & krate. owners ) ;
1157
+ let hir_body_hash = compute_hir_hash ( tcx) ;
1160
1158
1161
1159
let upstream_crates = upstream_crates ( tcx) ;
1162
1160
0 commit comments