about summary refs log tree commit diff
path: root/compiler/rustc_attr_parsing/src/attributes/confusables.rs
diff options
context:
space:
mode:
authorJana Dönszelmann <jana@donsz.nl>2025-03-05 14:35:54 +0100
committerJana Dönszelmann <jana@donsz.nl>2025-06-17 23:19:31 +0200
commit672452d573e3f499a8edc4308400a6d116974938 (patch)
tree0ea1d7e9f4949e268394b974c765221575e95732 /compiler/rustc_attr_parsing/src/attributes/confusables.rs
parentee976bbbcaf85390a00f03dedacd035e7e274e8e (diff)
downloadrust-672452d573e3f499a8edc4308400a6d116974938.tar.gz
rust-672452d573e3f499a8edc4308400a6d116974938.zip
use consistent attr errors in all attribute parsers
Diffstat (limited to 'compiler/rustc_attr_parsing/src/attributes/confusables.rs')
-rw-r--r--compiler/rustc_attr_parsing/src/attributes/confusables.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/compiler/rustc_attr_parsing/src/attributes/confusables.rs b/compiler/rustc_attr_parsing/src/attributes/confusables.rs
index 0be9d690c32..f4505cbc0e1 100644
--- a/compiler/rustc_attr_parsing/src/attributes/confusables.rs
+++ b/compiler/rustc_attr_parsing/src/attributes/confusables.rs
@@ -19,9 +19,7 @@ impl<S: Stage> AttributeParser<S> for ConfusablesParser {
         template!(List: r#""name1", "name2", ..."#),
         |this, cx, args| {
             let Some(list) = args.list() else {
-                // FIXME(jdonszelmann): error when not a list? Bring validation code here.
-                //       NOTE: currently subsequent attributes are silently ignored using
-                //       tcx.get_attr().
+                cx.expected_list(cx.attr_span);
                 return;
             };
 
@@ -33,13 +31,7 @@ impl<S: Stage> AttributeParser<S> for ConfusablesParser {
                 let span = param.span();
 
                 let Some(lit) = param.lit() else {
-                    cx.emit_err(session_diagnostics::IncorrectMetaItem {
-                        span,
-                        suggestion: Some(session_diagnostics::IncorrectMetaItemSuggestion {
-                            lo: span.shrink_to_lo(),
-                            hi: span.shrink_to_hi(),
-                        }),
-                    });
+                    cx.expected_string_literal(span);
                     continue;
                 };