rust-lang / rust-lang/rust-analyzer

multi macro_rules with the same name, rename failed

Open
#17,855 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-ide A-nameres C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: rust-analyzer 1.82.0-nightly (7c2012d0 2024-07-26)

rustc version: rustc 1.82.0-nightly (7c2012d0e 2024-07-26)

editor or extension: Vim9.1 coc-rust-analyzer

code snippet to reproduce:

fn main() {
    macro_rules! foo {
        () => {
            1
        };
    }
    assert_eq!(foo!(), 1);
    macro_rules! foo {
        () => {
            2
        };
    }
    assert_eq!(foo!(), 2); // in this line rename `foo`
}

rename foo into bar

fn main() {
    macro_rules! foo {
        () => {
            1
        };
    }
    assert_eq!(bar!(), 1);
    macro_rules! bar {
        () => {
            2
        };
    }
    assert_eq!(bar!(), 2); // in this line rename `foo`
}

expect output:

fn main() {
    macro_rules! foo {
        () => {
            1
        };
    }
    assert_eq!(foo!(), 1);
    macro_rules! bar {
        () => {
            2
        };
    }
    assert_eq!(bar!(), 2); // in this line rename `foo`
}

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 reproducing the rename operation in the provided macro_rules example using rust-analyzer and Vim with coc-rust-analyzer. Trace the rename handling for the selected macro and verify that only the intended definition and invocation are changed, matching the expected output.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.