diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2020-11-11 21:57:54 +0100 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2020-11-26 21:29:27 +0100 |
| commit | 419a9186a4c8aeb2157298ea084a54c87ee2a653 (patch) | |
| tree | cbf5966066cc08039bdfd485ec43b1a3cb7d542b /compiler/rustc_hir/src/stable_hash_impls.rs | |
| parent | 65ecc481fac7ceced57d973a580d0a7ccbdcb192 (diff) | |
| download | rust-419a9186a4c8aeb2157298ea084a54c87ee2a653.tar.gz rust-419a9186a4c8aeb2157298ea084a54c87ee2a653.zip | |
Store ForeignItem in a side table.
Diffstat (limited to 'compiler/rustc_hir/src/stable_hash_impls.rs')
| -rw-r--r-- | compiler/rustc_hir/src/stable_hash_impls.rs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/compiler/rustc_hir/src/stable_hash_impls.rs b/compiler/rustc_hir/src/stable_hash_impls.rs index 1d3f44a0899..439fb88039b 100644 --- a/compiler/rustc_hir/src/stable_hash_impls.rs +++ b/compiler/rustc_hir/src/stable_hash_impls.rs @@ -1,8 +1,8 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; use crate::hir::{ - BodyId, Expr, ImplItem, ImplItemId, Item, ItemId, Mod, TraitItem, TraitItemId, Ty, - VisibilityKind, + BodyId, Expr, ForeignItemId, ImplItem, ImplItemId, Item, ItemId, Mod, TraitItem, TraitItemId, + Ty, VisibilityKind, }; use crate::hir_id::{HirId, ItemLocalId}; use rustc_span::def_id::{DefPathHash, LocalDefId}; @@ -52,6 +52,15 @@ impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ImplItemId { } } +impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for ForeignItemId { + type KeyType = (DefPathHash, ItemLocalId); + + #[inline] + fn to_stable_hash_key(&self, hcx: &HirCtx) -> (DefPathHash, ItemLocalId) { + self.hir_id.to_stable_hash_key(hcx) + } +} + impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for HirId { fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) { hcx.hash_hir_id(*self, hasher) @@ -77,6 +86,12 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for ItemId { } } +impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for ForeignItemId { + fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) { + hcx.hash_reference_to_item(self.hir_id, hasher) + } +} + impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for ImplItemId { fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) { hcx.hash_reference_to_item(self.hir_id, hasher) |
