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
This commit is contained in:
Jana Dönszelmann
2025-02-12 13:59:08 +01:00
parent 4e1b6d13a2
commit 6072207a11
32 changed files with 665 additions and 229 deletions

View File

@@ -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