Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions compiler/rustc_attr_parsing/src/attributes/macro_attrs.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use rustc_ast::AttrStyle;
use rustc_errors::DiagArgValue;
use rustc_hir::attrs::MacroUseArgs;

Expand Down Expand Up @@ -149,10 +148,9 @@ impl<S: Stage> SingleAttributeParser<S> for MacroExportParser {
]);

fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> {
let suggestions = || {
<Self as SingleAttributeParser<S>>::TEMPLATE
.suggestions(AttrStyle::Inner, "macro_export")
};
let attr_style = cx.attr_style;
let suggestions =
|| <Self as SingleAttributeParser<S>>::TEMPLATE.suggestions(attr_style, "macro_export");
let local_inner_macros = match args {
ArgParser::NoArgs => false,
ArgParser::List(list) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Future incompatibility report: Future breakage diagnostic:
warning: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
warning: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:7:1
|
LL | #[macro_export(hello, world)]
Expand All @@ -9,7 +9,7 @@ LL | #[macro_export(hello, world)]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>

Future breakage diagnostic:
warning: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
warning: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:14:1
|
LL | #[macro_export(not_local_inner_macros)]
Expand All @@ -19,7 +19,7 @@ LL | #[macro_export(not_local_inner_macros)]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>

Future breakage diagnostic:
warning: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
warning: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:31:1
|
LL | #[macro_export()]
Expand All @@ -29,7 +29,7 @@ LL | #[macro_export()]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>

Future breakage diagnostic:
warning: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
warning: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:38:1
|
LL | #[macro_export("blah")]
Expand Down
16 changes: 8 additions & 8 deletions tests/ui/attributes/invalid_macro_export_argument.deny.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:7:1
|
LL | #[macro_export(hello, world)]
Expand All @@ -12,7 +12,7 @@ note: the lint level is defined here
LL | #![cfg_attr(deny, deny(invalid_macro_export_arguments))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:14:1
|
LL | #[macro_export(not_local_inner_macros)]
Expand All @@ -21,7 +21,7 @@ LL | #[macro_export(not_local_inner_macros)]
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>

error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:31:1
|
LL | #[macro_export()]
Expand All @@ -30,7 +30,7 @@ LL | #[macro_export()]
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>

error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:38:1
|
LL | #[macro_export("blah")]
Expand All @@ -42,7 +42,7 @@ LL | #[macro_export("blah")]
error: aborting due to 4 previous errors

Future incompatibility report: Future breakage diagnostic:
error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:7:1
|
LL | #[macro_export(hello, world)]
Expand All @@ -57,7 +57,7 @@ LL | #![cfg_attr(deny, deny(invalid_macro_export_arguments))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Future breakage diagnostic:
error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:14:1
|
LL | #[macro_export(not_local_inner_macros)]
Expand All @@ -72,7 +72,7 @@ LL | #![cfg_attr(deny, deny(invalid_macro_export_arguments))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Future breakage diagnostic:
error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:31:1
|
LL | #[macro_export()]
Expand All @@ -87,7 +87,7 @@ LL | #![cfg_attr(deny, deny(invalid_macro_export_arguments))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Future breakage diagnostic:
error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/invalid_macro_export_argument.rs:38:1
|
LL | #[macro_export("blah")]
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/attributes/malformed-attrs.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `
LL | #[macro_use = 1]
| ^^^^^^^^^^^^^^^^

error: valid forms for the attribute are `#![macro_export(local_inner_macros)]` and `#![macro_export]`
error: valid forms for the attribute are `#[macro_export(local_inner_macros)]` and `#[macro_export]`
--> $DIR/malformed-attrs.rs:221:1
|
LL | #[macro_export = 18]
Expand Down
Loading