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

Module should be resolved correctly when conflicting with struct in use imports #19107

Open
Hmikihiro opened this issue Feb 7, 2025 · 2 comments
Labels
C-bug Category: bug

Comments

@Hmikihiro
Copy link
Contributor

rust-analyzer version: rust-analyzer version: 0.3.2291-standalone (f3998f7 2025-02-02) [/Users/UserName/.vscode/extensions/rust-lang.rust-analyzer-0.3.2291-darwin-arm64/server/rust-analyzer]

rustc version: rustc 1.84.1 (e71f9a9a9 2025-01-27)

editor or extension: VSCode, Version 0.3.2291

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer)

When I hover over or rename sub2 in line 3, it is duplicated because both top level subs as a struct and sub1::sub2 as a module are imported with use.
Although sub2 is displayed as a struct, it is actually a module.

I think this issue related with #18941

code snippet to reproduce:

fn main() {
    use sub1::sub2;
    let module_sub1_sub2 = sub2::fn_sub2();
    let top_level_struct_sub2 = sub2;
}

struct sub2;

impl sub2 {
    fn fn_sub2() -> sub2 {
        sub2
    }
}

mod sub1 {
    pub mod sub2 {
        pub fn fn_sub2() {}
    }
}
rename_item.mov
@ShoyuVanilla
Copy link
Member

I think that this has been fixed via #19088

@ChayimFriedman2
Copy link
Contributor

@ShoyuVanilla It has not, #19088 (per my suggestion) was focused on builtin shadowing. I outlined the steps to solve this there, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants