rust/tests/ui/attributes/macro_export_on_decl_macro.rs
Arthur Cohen bdf4e3de9c 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.
2023-08-07 21:14:28 +02:00

9 lines
238 B
Rust

// Using #[macro_export] on a decl macro has no effect and should warn
#![feature(decl_macro)]
#![deny(unused)]
#[macro_export] //~ ERROR `#[macro_export]` has no effect on declarative macro definitions
pub macro foo() {}
fn main() {}