rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.12k stars 1.58k forks source link

Public re-exports do not appear in code completion #17042

Open misaka10987 opened 5 months ago

misaka10987 commented 5 months ago

rust-analyzer version: v0.3.1916

rustc version: 1.76.0

editor or extension: VSCodium

relevant settings: None

code snippet to reproduce:

crate-a/lib.rs

pub fn add(a:i32,b:i32)->i32{
    a+b
}

crate-b/lib.rs

pub use crate_a::add as my_add;

crate-b/some.rs

fn xxx(){
    // type my_add here and there is no completion or auto-import.
}
misaka10987 commented 5 months ago

Also, there is a notice says "consider importing this function through its public re-export: use crate::my_add;" in the "Quick fix" option, but it will suggest you import crate_a::add instead of crate::my_add when clicked.

lnicola commented 5 months ago

That's a rustc message, does cargo check actually work?

misaka10987 commented 5 months ago

That's a rustc message, does cargo check actually work?

Yes an error[E0425]: cannot find function my_add in this scope is produced as expected