diff options
| author | Jana Dönszelmann <jana@donsz.nl> | 2025-02-12 13:59:08 +0100 |
|---|---|---|
| committer | Jana Dönszelmann <jana@donsz.nl> | 2025-06-12 09:56:47 +0200 |
| commit | 6072207a1151f212163e3c19d92ff4ea22f291b2 (patch) | |
| tree | 53855f9f1b959d32f14f0ae33f4cdd8c17f9ea88 /compiler/rustc_attr_parsing/src/lints.rs | |
| parent | 4e1b6d13a20e5b72922f085fb4b248848ca02910 (diff) | |
| download | rust-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_attr_parsing/src/lints.rs')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/lints.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/compiler/rustc_attr_parsing/src/lints.rs b/compiler/rustc_attr_parsing/src/lints.rs new file mode 100644 index 00000000000..d0d112446b4 --- /dev/null +++ b/compiler/rustc_attr_parsing/src/lints.rs @@ -0,0 +1,19 @@ +use rustc_attr_data_structures::lints::{AttributeLint, AttributeLintKind}; +use rustc_errors::LintEmitter; +use rustc_hir::HirId; + +use crate::session_diagnostics; + +pub fn emit_attribute_lint<L: LintEmitter>(lint: &AttributeLint<HirId>, lint_emitter: L) { + let AttributeLint { id, span, kind } = lint; + + match kind { + &AttributeLintKind::UnusedDuplicate { this, other, warning } => lint_emitter + .emit_node_span_lint( + rustc_session::lint::builtin::UNUSED_ATTRIBUTES, + *id, + *span, + session_diagnostics::UnusedDuplicate { this, other, warning }, + ), + } +} |
