diff options
| author | bors <bors@rust-lang.org> | 2025-06-18 06:25:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-06-18 06:25:21 +0000 |
| commit | 1bb335244c311a07cee165c28c553c869e6f64a9 (patch) | |
| tree | ab7ce41f86ed7f64188504f84acb3fb137ca1fc9 /compiler/rustc_attr_parsing/src/lints.rs | |
| parent | 27733d46d79f4eb92e240fbba502c43022665735 (diff) | |
| parent | 81f8b570b9dd5d7bef27e1f1391dc73eb8fa4ff6 (diff) | |
| download | rust-1bb335244c311a07cee165c28c553c869e6f64a9.tar.gz rust-1bb335244c311a07cee165c28c553c869e6f64a9.zip | |
Auto merge of #138165 - jdonszelmann:inline, r=oli-obk
Rewrite `inline` attribute parser to use new infrastructure and improve diagnostics for all parsed attributes r? `@oli-obk` This PR: - creates a new parser for inline attributes - creates consistent error messages and error codes between attribute parsers; inline and others - as such changes a few error messages for other attributes to be (in my eyes) much more consistent - tests ast-lowering lints introduced by rust-lang/rust#138164 since this is now useful for the first time - Coalesce some useless error codes Builds on top of rust-lang/rust#138164 Closes rust-lang/rust#137950
Diffstat (limited to 'compiler/rustc_attr_parsing/src/lints.rs')
| -rw-r--r-- | compiler/rustc_attr_parsing/src/lints.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/compiler/rustc_attr_parsing/src/lints.rs b/compiler/rustc_attr_parsing/src/lints.rs index d0d112446b4..fee22293b47 100644 --- a/compiler/rustc_attr_parsing/src/lints.rs +++ b/compiler/rustc_attr_parsing/src/lints.rs @@ -1,5 +1,5 @@ use rustc_attr_data_structures::lints::{AttributeLint, AttributeLintKind}; -use rustc_errors::LintEmitter; +use rustc_errors::{DiagArgValue, LintEmitter}; use rustc_hir::HirId; use crate::session_diagnostics; @@ -15,5 +15,18 @@ pub fn emit_attribute_lint<L: LintEmitter>(lint: &AttributeLint<HirId>, lint_emi *span, session_diagnostics::UnusedDuplicate { this, other, warning }, ), + AttributeLintKind::IllFormedAttributeInput { suggestions } => { + lint_emitter.emit_node_span_lint( + rustc_session::lint::builtin::ILL_FORMED_ATTRIBUTE_INPUT, + *id, + *span, + session_diagnostics::IllFormedAttributeInput { + num_suggestions: suggestions.len(), + suggestions: DiagArgValue::StrListSepByAnd( + suggestions.into_iter().map(|s| format!("`{s}`").into()).collect(), + ), + }, + ); + } } } |
