@@ -102,7 +102,9 @@ struct LoweringContext<'a, 'hir: 'a> {
102102
103103 /// The items being lowered are collected here.
104104 owners : IndexVec < LocalDefId , Option < hir:: OwnerInfo < ' hir > > > ,
105+ /// Bodies inside the owner being lowered.
105106 bodies : IndexVec < hir:: ItemLocalId , Option < & ' hir hir:: Body < ' hir > > > ,
107+ /// Attributes inside the owner being lowered.
106108 attrs : BTreeMap < hir:: ItemLocalId , & ' hir [ Attribute ] > ,
107109
108110 generator_kind : Option < hir:: GeneratorKind > ,
@@ -418,6 +420,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
418420 self . arena . alloc ( krate)
419421 }
420422
423+ /// Compute the hash for the HIR of the full crate.
424+ /// This hash will then be part of the crate_hash which is stored in the metadata.
421425 fn compute_hir_hash ( & mut self ) -> Fingerprint {
422426 let definitions = self . resolver . definitions ( ) ;
423427 let mut hir_body_nodes: Vec < _ > = self
@@ -493,10 +497,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
493497 }
494498 }
495499
496- let ( hash , node_hash ) = self . hash_body ( node, & bodies) ;
500+ let ( hash_including_bodies , hash_without_bodies ) = self . hash_owner ( node, & bodies) ;
497501 let ( nodes, parenting) =
498502 index:: index_hir ( self . sess , self . resolver . definitions ( ) , node, & bodies) ;
499- let nodes = hir:: OwnerNodes { hash , node_hash , nodes, bodies } ;
503+ let nodes = hir:: OwnerNodes { hash_including_bodies , hash_without_bodies , nodes, bodies } ;
500504 let attrs = {
501505 let mut hcx = self . resolver . create_stable_hashing_context ( ) ;
502506 let mut stable_hasher = StableHasher :: new ( ) ;
@@ -510,7 +514,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
510514
511515 /// Hash the HIR node twice, one deep and one shallow hash. This allows to differentiate
512516 /// queries which depend on the full HIR tree and those which only depend on the item signature.
513- fn hash_body (
517+ fn hash_owner (
514518 & mut self ,
515519 node : hir:: OwnerNode < ' hir > ,
516520 bodies : & IndexVec < hir:: ItemLocalId , Option < & ' hir hir:: Body < ' hir > > > ,
@@ -520,13 +524,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
520524 hcx. with_hir_bodies ( true , node. def_id ( ) , bodies, |hcx| {
521525 node. hash_stable ( hcx, & mut stable_hasher)
522526 } ) ;
523- let full_hash = stable_hasher. finish ( ) ;
527+ let hash_including_bodies = stable_hasher. finish ( ) ;
524528 let mut stable_hasher = StableHasher :: new ( ) ;
525529 hcx. with_hir_bodies ( false , node. def_id ( ) , bodies, |hcx| {
526530 node. hash_stable ( hcx, & mut stable_hasher)
527531 } ) ;
528- let node_hash = stable_hasher. finish ( ) ;
529- ( full_hash , node_hash )
532+ let hash_without_bodies = stable_hasher. finish ( ) ;
533+ ( hash_including_bodies , hash_without_bodies )
530534 }
531535
532536 /// This method allocates a new `HirId` for the given `NodeId` and stores it in
0 commit comments