From 6072207a1151f212163e3c19d92ff4ea22f291b2 Mon Sep 17 00:00:00 2001 From: Jana Dönszelmann Date: Wed, 12 Feb 2025 13:59:08 +0100 Subject: 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 --- compiler/rustc_attr_data_structures/src/lib.rs | 2 ++ compiler/rustc_attr_data_structures/src/lints.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 compiler/rustc_attr_data_structures/src/lints.rs (limited to 'compiler/rustc_attr_data_structures') diff --git a/compiler/rustc_attr_data_structures/src/lib.rs b/compiler/rustc_attr_data_structures/src/lib.rs index dbfc95b047a..b0fc19d1cd7 100644 --- a/compiler/rustc_attr_data_structures/src/lib.rs +++ b/compiler/rustc_attr_data_structures/src/lib.rs @@ -8,6 +8,8 @@ mod attributes; mod stability; mod version; +pub mod lints; + use std::num::NonZero; pub use attributes::*; diff --git a/compiler/rustc_attr_data_structures/src/lints.rs b/compiler/rustc_attr_data_structures/src/lints.rs new file mode 100644 index 00000000000..7e3664b2263 --- /dev/null +++ b/compiler/rustc_attr_data_structures/src/lints.rs @@ -0,0 +1,14 @@ +use rustc_macros::HashStable_Generic; +use rustc_span::Span; + +#[derive(Clone, Debug, HashStable_Generic)] +pub struct AttributeLint { + pub id: Id, + pub span: Span, + pub kind: AttributeLintKind, +} + +#[derive(Clone, Debug, HashStable_Generic)] +pub enum AttributeLintKind { + UnusedDuplicate { this: Span, other: Span, warning: bool }, +} -- cgit 1.4.1-3-g733a5