mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Stop using IllFormedAttributeInputLint for macro_use
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user