gccrs icon indicating copy to clipboard operation
gccrs copied to clipboard

Handle `#[macro_export(local_inner_macros)]` variant

Open CohenArthur opened this issue 3 years ago • 0 comments

When a macro is exported, the #[macro_export] attribute can have the local_inner_macros keyword added to automatically prefix all contained macro invocations with $crate::. This is intended primarily as a tool to migrate code written before $crate was added to the language to work with Rust 2018's path-based imports of macros. Its use is discouraged in new code.

#[macro_export(local_inner_macros)]
macro_rules! helped {
    () => { helper!() } // Automatically converted to $crate::helper!().
}

#[macro_export]
macro_rules! helper {
    () => { () }
}

CohenArthur avatar Sep 14 '22 08:09 CohenArthur