Move some HashStable impls.

This commit is contained in:
Camille GILLOT 2021-09-19 23:03:21 +02:00
parent c24c9067ee
commit b66dfaaa64
3 changed files with 22 additions and 44 deletions

View file

@ -33,6 +33,25 @@ impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for HirId {
}
}
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ItemLocalId {
type KeyType = ItemLocalId;
#[inline]
fn to_stable_hash_key(&self, _: &HirCtx) -> ItemLocalId {
*self
}
}
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for BodyId {
type KeyType = (DefPathHash, ItemLocalId);
#[inline]
fn to_stable_hash_key(&self, hcx: &HirCtx) -> (DefPathHash, ItemLocalId) {
let BodyId { hir_id } = *self;
hir_id.to_stable_hash_key(hcx)
}
}
impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ItemId {
type KeyType = DefPathHash;