Skip to content

Tracking Issue for future-incompatibility lint out_of_scope_macro_calls #144406

Open

Description

@petrochenkov

The out_of_scope_macro_calls lint detects macro_rules called when they are not in scope,
above their definition, which may happen in key-value attributes.

Example

#![doc = in_root!()]

macro_rules! in_root { () => { "" } }

fn main() {}

Explanation

The scope in which a macro_rules item is visible starts at that item and continues
below it. This is more similar to let than to other items, which are in scope both above
and below their definition.
Due to a bug macro_rules were accidentally in scope inside some key-value attributes
above their definition. The lint catches such cases.
To address the issue turn the macro_rules into a regularly scoped item by importing it
with use.

Implementation history

Activity

  1. added
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Jul 24, 2025
  2. changed the title [-]Tracking Issue for deprecation lint `out_of_scope_macro_calls`[/-] [+]Tracking Issue for future-incompatibility lint `out_of_scope_macro_calls`[/+] on Jul 24, 2025
  3. added
    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jul 24, 2025
  4. added 6 commits that reference this issue on Aug 6, 2025
  5. added a commit that references this issue on Aug 7, 2025
  6. added
    A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
    on Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-decl-macros-1-2Area: Declarative macros 1.2A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)C-future-incompatibilityCategory: Future-incompatibility lintsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions