1
Fork 0

check_attrs: Warn when #[macro_export] is used on macros 2.0

The compiler should emit a more specific error when the `#[macro_export]`
attribute is present on a decl macro, instead of silently ignoring it.

This commit adds the required error message in rustc_passes/messages.ftl,
 as well as a note. A new variant is added to the `errors::MacroExport`
enum, specifically for the case where the attribute is added to a macro
2.0.
This commit is contained in:
Arthur Cohen 2023-08-02 20:08:28 +02:00
parent f1776250eb
commit bdf4e3de9c
5 changed files with 47 additions and 0 deletions

View file

@ -428,6 +428,10 @@ passes_link_section =
passes_macro_export =
`#[macro_export]` only has an effect on macro definitions
passes_macro_export_on_decl_macro =
`#[macro_export]` has no effect on declarative macro definitions
.note = declarative macros follow the same exporting rules as regular items
passes_macro_use =
`#[{$name}]` only has an effect on `extern crate` and modules