about summary refs log tree commit diff
path: root/compiler/rustc_attr_parsing/src/lints.rs
diff options
context:
space:
mode:
authorSasha Pourcelot <sasha.pourcelot@protonmail.com>2025-08-23 19:45:00 +0200
committerSasha Pourcelot <sasha.pourcelot@protonmail.com>2025-08-25 21:31:04 +0200
commita8e9ca195e8345fc574420418d2fd3aed258f703 (patch)
tree12ec4f975e39c3cf444b59078625ff439f8a2aee /compiler/rustc_attr_parsing/src/lints.rs
parent93edf9f9b0bf284d8f8cbe52af5d0569d0cf5850 (diff)
downloadrust-a8e9ca195e8345fc574420418d2fd3aed258f703.tar.gz
rust-a8e9ca195e8345fc574420418d2fd3aed258f703.zip
Use attribute name in message for "outer attr used as inner attr" errors
Diffstat (limited to 'compiler/rustc_attr_parsing/src/lints.rs')
-rw-r--r--compiler/rustc_attr_parsing/src/lints.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_attr_parsing/src/lints.rs b/compiler/rustc_attr_parsing/src/lints.rs
index 069478e7f0c..1f6d7922960 100644
--- a/compiler/rustc_attr_parsing/src/lints.rs
+++ b/compiler/rustc_attr_parsing/src/lints.rs
@@ -60,5 +60,19 @@ pub fn emit_attribute_lint<L: LintEmitter>(lint: &AttributeLint<L::Id>, lint_emi
                     attr_span: *span,
                 },
             ),
+
+        &AttributeLintKind::InvalidStyle { ref name, is_used_as_inner, target, target_span } => {
+            lint_emitter.emit_node_span_lint(
+                rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
+                *id,
+                *span,
+                session_diagnostics::InvalidAttrStyle {
+                    name: name.clone(),
+                    is_used_as_inner,
+                    target_span: (!is_used_as_inner).then_some(target_span),
+                    target,
+                },
+            )
+        }
     }
 }