about summary refs log tree commit diff
path: root/compiler/rustc_hir/src/stable_hash_impls.rs
diff options
context:
space:
mode:
authorJana Dönszelmann <jana@donsz.nl>2025-02-12 13:59:08 +0100
committerJana Dönszelmann <jana@donsz.nl>2025-06-12 09:56:47 +0200
commit6072207a1151f212163e3c19d92ff4ea22f291b2 (patch)
tree53855f9f1b959d32f14f0ae33f4cdd8c17f9ea88 /compiler/rustc_hir/src/stable_hash_impls.rs
parent4e1b6d13a20e5b72922f085fb4b248848ca02910 (diff)
downloadrust-6072207a1151f212163e3c19d92ff4ea22f291b2.tar.gz
rust-6072207a1151f212163e3c19d92ff4ea22f291b2.zip
introduce new lint infra
 lint on duplicates during attribute parsing
To do this we stuff them in the diagnostic context to be emitted after
hir is constructed
Diffstat (limited to 'compiler/rustc_hir/src/stable_hash_impls.rs')
-rw-r--r--compiler/rustc_hir/src/stable_hash_impls.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_hir/src/stable_hash_impls.rs b/compiler/rustc_hir/src/stable_hash_impls.rs
index 91ea88cae47..6acf1524b60 100644
--- a/compiler/rustc_hir/src/stable_hash_impls.rs
+++ b/compiler/rustc_hir/src/stable_hash_impls.rs
@@ -6,6 +6,7 @@ use crate::hir::{
     AttributeMap, BodyId, Crate, ForeignItemId, ImplItemId, ItemId, OwnerNodes, TraitItemId,
 };
 use crate::hir_id::{HirId, ItemLocalId};
+use crate::lints::DelayedLints;
 
 /// Requirements for a `StableHashingContext` to be used in this crate.
 /// This is a hack to allow using the `HashStable_Generic` derive macro
@@ -102,6 +103,13 @@ impl<'tcx, HirCtx: crate::HashStableContext> HashStable<HirCtx> for OwnerNodes<'
     }
 }
 
+impl<HirCtx: crate::HashStableContext> HashStable<HirCtx> for DelayedLints {
+    fn hash_stable(&self, hcx: &mut HirCtx, hasher: &mut StableHasher) {
+        let DelayedLints { opt_hash, .. } = *self;
+        opt_hash.unwrap().hash_stable(hcx, hasher);
+    }
+}
+
 impl<'tcx, 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 `opt_hash` which is