这是indexloc提供的服务,不要输入任何密码
Skip to content

Tracking Issue for future-incompatibility lint out_of_scope_macro_calls #144406

@petrochenkov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.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