Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn when #[macro_export] is applied on decl macros #114413

Merged
merged 2 commits into from
Aug 8, 2023

Commits on Aug 7, 2023

  1. core: Remove #[macro_export] from debug_assert_matches

    The `debug_assert_matches` macro was marked with the `#[macro_export]` attribute,
    despite being a declarative macro/macro 2.0, for which the exporting rules are similar
    to items. In fact, `#[macro_export]` on a decl macro has no effect on its visibility.
    CohenArthur committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    f177625 View commit details
    Browse the repository at this point in the history
  2. 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.
    CohenArthur committed Aug 7, 2023
    Configuration menu
    Copy the full SHA
    bdf4e3d View commit details
    Browse the repository at this point in the history