diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-09-19 22:07:12 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-10-10 00:05:49 +0200 |
| commit | 0431fdb11312ae324c73e4dab1e5be5c45164678 (patch) | |
| tree | 39aae5d9d2e9ea4bb171848f327abf4dfd9e0e29 /compiler/rustc_hir/src/stable_hash_impls.rs | |
| parent | 41e80b85cf05e6373b589b876d3ee65823196406 (diff) | |
| download | rust-0431fdb11312ae324c73e4dab1e5be5c45164678.tar.gz rust-0431fdb11312ae324c73e4dab1e5be5c45164678.zip | |
Compute full HIR hash during lowering.
Diffstat (limited to 'compiler/rustc_hir/src/stable_hash_impls.rs')
| -rw-r--r-- | compiler/rustc_hir/src/stable_hash_impls.rs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/compiler/rustc_hir/src/stable_hash_impls.rs b/compiler/rustc_hir/src/stable_hash_impls.rs index da2aeb9b311..3c9fe93b67d 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::{ - AttributeMap, BodyId, Expr, ForeignItem, ForeignItemId, ImplItem, ImplItemId, Item, ItemId, - Mod, OwnerNodes, TraitItem, TraitItemId, Ty, VisibilityKind, + AttributeMap, BodyId, Crate, Expr, ForeignItem, ForeignItemId, ImplItem, ImplItemId, Item, + ItemId, Mod, OwnerNodes, TraitCandidate, TraitItem, TraitItemId, Ty, VisibilityKind, }; use crate::hir_id::{HirId, ItemLocalId}; use rustc_span::def_id::DefPathHash; @@ -21,6 +21,7 @@ pub trait HashStableContext: fn hash_hir_ty(&mut self, _: &Ty<'_>, hasher: &mut StableHasher); fn hash_hir_visibility_kind(&mut self, _: &VisibilityKind<'_>, hasher: &mut StableHasher); fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self, f: F); + fn hash_hir_trait_candidate(&mut self, _: &TraitCandidate, hasher: &mut StableHasher); } impl<HirCtx: crate::HashStableContext> ToStableHashKey<HirCtx> for HirId { @@ -227,3 +228,16 @@ impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for AttributeMap<'tcx> hash.hash_stable(hcx, hasher); } } + +impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for Crate<'_> { + fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) { + let Crate { owners: _, hir_hash } = self; + hir_hash.hash_stable(hcx, hasher) + } +} + +impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for TraitCandidate { + fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) { + hcx.hash_hir_trait_candidate(self, hasher) + } +} |
