Stop using IllFormedAttributeInputLint for macro_use

This commit is contained in:
Jonathan Brouwer
2025-12-13 13:33:45 +01:00
parent f357e51e89
commit 6a7ed1353d
3 changed files with 13 additions and 14 deletions
@@ -1,9 +1,7 @@
use rustc_errors::DiagArgValue;
use rustc_hir::attrs::MacroUseArgs;
use rustc_session::lint::builtin::INVALID_MACRO_EXPORT_ARGUMENTS;
use super::prelude::*;
use crate::session_diagnostics::{AttributeParseErrorReason, IllFormedAttributeInputLint};
pub(crate) struct MacroEscapeParser;
impl<S: Stage> NoArgsAttributeParser<S> for MacroEscapeParser {
@@ -158,15 +156,7 @@ fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser) -> Option<Attrib
}
}
ArgParser::NameValue(_) => {
let span = cx.attr_span;
let suggestions = cx.suggestions();
cx.emit_err(IllFormedAttributeInputLint {
num_suggestions: suggestions.len(),
suggestions: DiagArgValue::StrListSepByAnd(
suggestions.into_iter().map(|s| format!("`{s}`").into()).collect(),
),
span,
});
cx.expected_list_or_no_args(cx.attr_span);
return None;
}
};
+1 -1
View File
@@ -219,7 +219,7 @@ enum Slenum {
//~^ ERROR can't find crate for `wloop` [E0463]
#[macro_export = 18]
//~^ ERROR valid forms for the attribute are
//~^ ERROR malformed
#[allow_internal_unsafe = 1]
//~^ ERROR malformed
//~| ERROR allow_internal_unsafe side-steps the unsafe_code lint
+11 -2
View File
@@ -630,11 +630,20 @@ LL - #[macro_use = 1]
LL + #[macro_use]
|
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
error[E0539]: malformed `macro_export` attribute input
--> $DIR/malformed-attrs.rs:221:1
|
LL | #[macro_export = 18]
| ^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^ expected a list or no arguments here
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[macro_export = 18]
LL + #[macro_export(local_inner_macros)]
|
LL - #[macro_export = 18]
LL + #[macro_export]
|
error[E0565]: malformed `allow_internal_unsafe` attribute input
--> $DIR/malformed-attrs.rs:223:1