about summary refs log tree commit diff
path: root/compiler/rustc_hir/src/stable_hash_impls.rs
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2021-09-12 11:41:35 +0200
committerCamille GILLOT <gillot.camille@gmail.com>2021-10-10 00:05:35 +0200
commit41e80b85cf05e6373b589b876d3ee65823196406 (patch)
treedec4743b93f4653a9e25483ab5c80b3e197eabda /compiler/rustc_hir/src/stable_hash_impls.rs
parent1c7f85f17c0ddde890ced0ba4445e122c1ffc093 (diff)
downloadrust-41e80b85cf05e6373b589b876d3ee65823196406.tar.gz
rust-41e80b85cf05e6373b589b876d3ee65823196406.zip
Directly use AttributeMap inside OwnerInfo.
Diffstat (limited to 'compiler/rustc_hir/src/stable_hash_impls.rs')
-rw-r--r--compiler/rustc_hir/src/stable_hash_impls.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/rustc_hir/src/stable_hash_impls.rs b/compiler/rustc_hir/src/stable_hash_impls.rs
index ad73e363d7f..da2aeb9b311 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, 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);
+    }
+}