File tree Expand file tree Collapse file tree 3 files changed +14
-14
lines changed
compiler/rustc_attr_parsing/src/attributes Expand file tree Collapse file tree 3 files changed +14
-14
lines changed Original file line number Diff line number Diff line change 1- use rustc_errors:: DiagArgValue ;
21use rustc_hir:: attrs:: MacroUseArgs ;
32use rustc_session:: lint:: builtin:: INVALID_MACRO_EXPORT_ARGUMENTS ;
43
54use super :: prelude:: * ;
6- use crate :: session_diagnostics:: { AttributeParseErrorReason , IllFormedAttributeInputLint } ;
5+ use crate :: session_diagnostics:: AttributeParseErrorReason ;
76
87pub ( crate ) struct MacroEscapeParser ;
98impl < S : Stage > NoArgsAttributeParser < S > for MacroEscapeParser {
@@ -158,15 +157,7 @@ impl<S: Stage> SingleAttributeParser<S> for MacroExportParser {
158157 }
159158 }
160159 ArgParser :: NameValue ( _) => {
161- let span = cx. attr_span ;
162- let suggestions = cx. suggestions ( ) ;
163- cx. emit_err ( IllFormedAttributeInputLint {
164- num_suggestions : suggestions. len ( ) ,
165- suggestions : DiagArgValue :: StrListSepByAnd (
166- suggestions. into_iter ( ) . map ( |s| format ! ( "`{s}`" ) . into ( ) ) . collect ( ) ,
167- ) ,
168- span,
169- } ) ;
160+ cx. emit_parse_error ( cx. attr_span , AttributeParseErrorReason :: ExpectedListOrNoArgs ) ;
170161 return None ;
171162 }
172163 } ;
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ extern crate wloop;
219219//~^ ERROR can't find crate for `wloop` [E0463]
220220
221221#[ macro_export = 18 ]
222- //~^ ERROR valid forms for the attribute are
222+ //~^ ERROR malformed
223223#[ allow_internal_unsafe = 1 ]
224224//~^ ERROR malformed
225225//~| ERROR allow_internal_unsafe side-steps the unsafe_code lint
Original file line number Diff line number Diff line change @@ -630,11 +630,20 @@ LL - #[macro_use = 1]
630630LL + #[macro_use]
631631 |
632632
633- error: valid forms for the attribute are `#[ macro_export(local_inner_macros)]` and `#[macro_export]`
633+ error[E0539]: malformed ` macro_export` attribute input
634634 --> $DIR/malformed-attrs.rs:221:1
635635 |
636636LL | #[macro_export = 18]
637- | ^^^^^^^^^^^^^^^^^^^^
637+ | ^^^^^^^^^^^^^^^^^^^^ expected a list or no arguments here
638+ |
639+ help: try changing it to one of the following valid forms of the attribute
640+ |
641+ LL - #[macro_export = 18]
642+ LL + #[macro_export(local_inner_macros)]
643+ |
644+ LL - #[macro_export = 18]
645+ LL + #[macro_export]
646+ |
638647
639648error[E0565]: malformed `allow_internal_unsafe` attribute input
640649 --> $DIR/malformed-attrs.rs:223:1
You can’t perform that action at this time.
0 commit comments