@@ -10,7 +10,6 @@ use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
1010use rustc_hir:: intravisit:: Visitor ;
1111use rustc_hir:: * ;
1212use rustc_hir_pretty as pprust_hir;
13- use rustc_index:: IndexSlice ;
1413use rustc_span:: def_id:: StableCrateId ;
1514use rustc_span:: { ErrorGuaranteed , Ident , Span , Symbol , kw, sym, with_metavar_spans} ;
1615
@@ -1133,16 +1132,16 @@ impl<'tcx> pprust_hir::PpAnn for TyCtxt<'tcx> {
11331132
11341133/// Compute the hash for the HIR of the full crate.
11351134/// 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 )
11461145 } )
11471146 . collect ( ) ;
11481147 hir_body_nodes. sort_unstable_by_key ( |bn| bn. 0 ) ;
@@ -1155,8 +1154,7 @@ fn compute_hir_hash(
11551154}
11561155
11571156pub ( 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) ;
11601158
11611159 let upstream_crates = upstream_crates ( tcx) ;
11621160
0 commit comments