@@ -3,7 +3,7 @@ use rustc_span::def_id::DefPathHash;
33
44use crate :: HashIgnoredAttrId ;
55use crate :: hir:: {
6- AttributeMap , BodyId , ForeignItemId , ImplItemId , ItemId , OwnerNodes , TraitItemId ,
6+ AttributeMap , BodyId , ForeignItemId , ImplItemId , ItemId , OwnerInfo , OwnerNodes , TraitItemId ,
77} ;
88use crate :: hir_id:: { HirId , ItemLocalId } ;
99use crate :: lints:: DelayedLints ;
@@ -92,25 +92,25 @@ impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ForeignItemId
9292// in "DefPath Mode".
9393
9494impl < ' tcx , HirCtx : crate :: HashStableContext > HashStable < HirCtx > for OwnerNodes < ' tcx > {
95+ #[ inline]
9596 fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
96- // We ignore the `nodes` and `bodies` fields since these refer to information included in
97- // `hash` which is hashed in the collector and used for the crate hash.
98- // `local_id_to_def_id` is also ignored because is dependent on the body, then just hashing
99- // the body satisfies the condition of two nodes being different have different
100- // `hash_stable` results.
101- let OwnerNodes { opt_hash_including_bodies, nodes : _, bodies : _ } = * self ;
102- opt_hash_including_bodies. unwrap ( ) . hash_stable ( hcx, hasher) ;
97+ // We ignore the other fields since these refer to information included in
98+ // `opt_hash` which is hashed in the collector and used for the crate hash.
99+ let OwnerNodes { opt_hash, .. } = * self ;
100+ opt_hash. unwrap ( ) . hash_stable ( hcx, hasher) ;
103101 }
104102}
105103
106104impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for DelayedLints {
105+ #[ inline]
107106 fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
108107 let DelayedLints { opt_hash, .. } = * self ;
109108 opt_hash. unwrap ( ) . hash_stable ( hcx, hasher) ;
110109 }
111110}
112111
113112impl < ' tcx , HirCtx : crate :: HashStableContext > HashStable < HirCtx > for AttributeMap < ' tcx > {
113+ #[ inline]
114114 fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
115115 // We ignore the `map` since it refers to information included in `opt_hash` which is
116116 // hashed in the collector and used for the crate hash.
@@ -119,6 +119,16 @@ impl<'tcx, HirCtx: crate::HashStableContext> HashStable<HirCtx> for AttributeMap
119119 }
120120}
121121
122+ impl < ' tcx , HirCtx : crate :: HashStableContext > HashStable < HirCtx > for OwnerInfo < ' tcx > {
123+ #[ inline]
124+ fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
125+ // We ignore the rest since it refers to information included in `opt_hash` which is
126+ // hashed in the collector and used for the crate hash.
127+ let OwnerInfo { opt_hash, .. } = * self ;
128+ opt_hash. unwrap ( ) . hash_stable ( hcx, hasher) ;
129+ }
130+ }
131+
122132impl < HirCtx : crate :: HashStableContext > HashStable < HirCtx > for HashIgnoredAttrId {
123133 fn hash_stable ( & self , hcx : & mut HirCtx , hasher : & mut StableHasher ) {
124134 hcx. hash_attr_id ( self , hasher)
0 commit comments