Directly use AttributeMap inside OwnerInfo.

This commit is contained in:
Camille GILLOT
2021-09-12 11:41:35 +02:00
parent 1c7f85f17c
commit 41e80b85cf
8 changed files with 42 additions and 28 deletions

View File

@@ -1,8 +1,8 @@
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
use crate::hir::{
BodyId, Expr, ForeignItem, ForeignItemId, ImplItem, ImplItemId, Item, ItemId, Mod, OwnerNodes,
TraitItem, TraitItemId, Ty, VisibilityKind,
AttributeMap, BodyId, Expr, ForeignItem, ForeignItemId, ImplItem, ImplItemId, Item, ItemId,
Mod, OwnerNodes, TraitItem, TraitItemId, Ty, VisibilityKind,
};
use crate::hir_id::{HirId, ItemLocalId};
use rustc_span::def_id::DefPathHash;
@@ -218,3 +218,12 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for OwnerNodes<'tcx> {
hash.hash_stable(hcx, hasher);
}
}
impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for AttributeMap<'tcx> {
fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
// We ignore the `map` since it refers to information included in `hash` which is hashed in
// the collector and used for the crate hash.
let AttributeMap { hash, map: _ } = *self;
hash.hash_stable(hcx, hasher);
}
}