rust-lang / rust-lang/rust

Tracking Issue for future-incompatibility lint `macro_expanded_macro_exports_accessed_by_absolute_paths`

Open
#144,408 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-lints C-future-incompatibility C-tracking-issue T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

The macro_expanded_macro_exports_accessed_by_absolute_paths lint
detects macro-expanded macro_export macros from the current crate
that cannot be referred to by absolute paths.

Example
macro_rules! define_exported {
    () => {
        #[macro_export]
        macro_rules! exported {
            () => {};
        }
    };
}

define_exported!();

fn main() {
    crate::exported!();
}
Explanation

The intent is that all macros marked with the #[macro_export]
attribute are made available in the root of the crate. However, when a
macro_rules! definition is generated by another macro, the macro
expansion is unable to uphold this rule.
See https://github.com/rust-lang/rust/pull/52234#issuecomment-486819782 for more details.

Implementation history

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the implementation history in PRs #52234, #53653, and #143929, then use the compile-fail example in this issue to understand the current behavior. The work is done when this future-incompatibility lint becomes a hard error, with the example and relevant compiler behavior updated accordingly.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.