@@ -102,7 +102,9 @@ struct LoweringContext<'a, 'hir: 'a> {
102
102
103
103
/// The items being lowered are collected here.
104
104
owners : IndexVec < LocalDefId , Option < hir:: OwnerInfo < ' hir > > > ,
105
+ /// Bodies inside the owner being lowered.
105
106
bodies : IndexVec < hir:: ItemLocalId , Option < & ' hir hir:: Body < ' hir > > > ,
107
+ /// Attributes inside the owner being lowered.
106
108
attrs : BTreeMap < hir:: ItemLocalId , & ' hir [ Attribute ] > ,
107
109
108
110
generator_kind : Option < hir:: GeneratorKind > ,
@@ -418,6 +420,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
418
420
self . arena . alloc ( krate)
419
421
}
420
422
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.
421
425
fn compute_hir_hash ( & mut self ) -> Fingerprint {
422
426
let definitions = self . resolver . definitions ( ) ;
423
427
let mut hir_body_nodes: Vec < _ > = self
@@ -493,10 +497,10 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
493
497
}
494
498
}
495
499
496
- let ( hash , node_hash ) = self . hash_body ( node, & bodies) ;
500
+ let ( hash_including_bodies , hash_without_bodies ) = self . hash_owner ( node, & bodies) ;
497
501
let ( nodes, parenting) =
498
502
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 } ;
500
504
let attrs = {
501
505
let mut hcx = self . resolver . create_stable_hashing_context ( ) ;
502
506
let mut stable_hasher = StableHasher :: new ( ) ;
@@ -510,7 +514,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
510
514
511
515
/// Hash the HIR node twice, one deep and one shallow hash. This allows to differentiate
512
516
/// 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 (
514
518
& mut self ,
515
519
node : hir:: OwnerNode < ' hir > ,
516
520
bodies : & IndexVec < hir:: ItemLocalId , Option < & ' hir hir:: Body < ' hir > > > ,
@@ -520,13 +524,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
520
524
hcx. with_hir_bodies ( true , node. def_id ( ) , bodies, |hcx| {
521
525
node. hash_stable ( hcx, & mut stable_hasher)
522
526
} ) ;
523
- let full_hash = stable_hasher. finish ( ) ;
527
+ let hash_including_bodies = stable_hasher. finish ( ) ;
524
528
let mut stable_hasher = StableHasher :: new ( ) ;
525
529
hcx. with_hir_bodies ( false , node. def_id ( ) , bodies, |hcx| {
526
530
node. hash_stable ( hcx, & mut stable_hasher)
527
531
} ) ;
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 )
530
534
}
531
535
532
536
/// This method allocates a new `HirId` for the given `NodeId` and stores it in
0 commit comments