diff options
| author | Sasha Pourcelot <sasha.pourcelot@protonmail.com> | 2025-08-23 19:45:00 +0200 |
|---|---|---|
| committer | Sasha Pourcelot <sasha.pourcelot@protonmail.com> | 2025-08-25 21:31:04 +0200 |
| commit | a8e9ca195e8345fc574420418d2fd3aed258f703 (patch) | |
| tree | 12ec4f975e39c3cf444b59078625ff439f8a2aee /compiler/rustc_attr_parsing/src/session_diagnostics.rs | |
| parent | 93edf9f9b0bf284d8f8cbe52af5d0569d0cf5850 (diff) | |
| download | rust-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/session_diagnostics.rs')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/session_diagnostics.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/rustc_attr_parsing/src/session_diagnostics.rs b/compiler/rustc_attr_parsing/src/session_diagnostics.rs index 72bee0ddfbf..a639b55e81f 100644 --- a/compiler/rustc_attr_parsing/src/session_diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/session_diagnostics.rs @@ -6,7 +6,7 @@ use rustc_errors::{ Applicability, Diag, DiagArgValue, DiagCtxtHandle, Diagnostic, EmissionGuarantee, Level, }; use rustc_feature::AttributeTemplate; -use rustc_hir::AttrPath; +use rustc_hir::{AttrPath, Target}; use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; use rustc_span::{Span, Symbol}; @@ -826,3 +826,13 @@ pub(crate) struct SuffixedLiteralInAttribute { #[primary_span] pub span: Span, } + +#[derive(LintDiagnostic)] +#[diag(attr_parsing_invalid_style)] +pub(crate) struct InvalidAttrStyle { + pub name: AttrPath, + pub is_used_as_inner: bool, + #[note] + pub target_span: Option<Span>, + pub target: Target, +} |
