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

multi macro_rules with the same name, rename failed #17855

Open
A4-Tacks opened this issue Aug 11, 2024 · 3 comments
Open

multi macro_rules with the same name, rename failed #17855

A4-Tacks opened this issue Aug 11, 2024 · 3 comments
Labels
A-ide general IDE features A-nameres name, path and module resolution C-bug Category: bug

Comments

@A4-Tacks
Copy link

A4-Tacks commented Aug 11, 2024

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`
}
@A4-Tacks A4-Tacks added the C-bug Category: bug label Aug 11, 2024
@ShoyuVanilla ShoyuVanilla added A-assists A-nameres name, path and module resolution A-ide general IDE features and removed A-assists labels Aug 13, 2024
@ChayimFriedman2
Copy link
Contributor

Let's see if I can do this (I guess this will involve some fundamental changes to namres)...

@rustbot claim

@Veykril
Copy link
Member

Veykril commented Sep 1, 2024

There is a couple of related issues to this #7084 #14862 #15749

The gist of the issue is that we don't handle the textual macro_rules scoping correctly (as well as the macro definition hierarchy https://rustc-dev-guide.rust-lang.org/macro-expansion.html#the-macro-definition-hierarchy)

@ChayimFriedman2
Copy link
Contributor

@rustbot release-assignment

Occupied with other things currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ide general IDE features A-nameres name, path and module resolution C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

4 participants