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

FP: expected H, found H with equally named structs #16292

Open
matthiaskrgr opened this issue Jan 6, 2024 · 0 comments
Open

FP: expected H, found H with equally named structs #16292

matthiaskrgr opened this issue Jan 6, 2024 · 0 comments
Labels
A-nameres name, path and module resolution C-bug Category: bug

Comments

@matthiaskrgr
Copy link
Member

// check-pass
// tests/ui/imports/import-after-macro-expand-11.rs

#[derive(Debug)]
struct H;

mod p {
    use super::*;

    // this struct confuses RA
    #[derive(Clone)]
    struct H;

    mod t {
        use super::*;

        fn f() {
           let h: crate::p::H = H;
        }
    }
}

fn main() {}

edition 2015

while this compiles with rustc, rust analyze throws an error:

warning: unused import: `super::*`
 --> src/main.rs:8:9
  |
8 |     use super::*;
  |         ^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `h`
  --> src/main.rs:18:16
   |
18 |            let h: crate::p::H = H;
   |                ^ help: if this is intentional, prefix it with an underscore: `_h`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: function `f` is never used
  --> src/main.rs:17:12
   |
17 |         fn f() {
   |            ^
   |
   = note: `#[warn(dead_code)]` on by default

warning: `bar` (bin "bar") generated 3 warnings (run `cargo fix --bin "bar"` to apply 2 suggestions)
processing crate: bar, module: /tmp/bar/src/main.rs
Diagnostic { code: RustcHardError("E0308"), message: "expected H, found H", range: FileRange { file_id: FileId(11), range: 273..274 }, severity: Error, unused: false, experimental: true, fixes: None, main_node: None }

diagnostic scan complete

Error: diagnostic error detected

rust-analyzer 1.77.0-nightly (595bc6f 2024-01-05)

@matthiaskrgr matthiaskrgr added the C-bug Category: bug label Jan 6, 2024
@Veykril Veykril added the A-nameres name, path and module resolution label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-nameres name, path and module resolution C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants