Skip to content

Import suggestions do not take into account visibility #18308

@orlp

Description

@orlp

I never had problems with this in the past, but suddenly rust-analyzer's import suggestions no longer take into account pub visibility. Unfortunately I don't have a minimal reproduction, but I do have a reproduction.

  1. Clone https://github.com/pola-rs/polars (suggest --depth 1).
  2. Edit file crates/polars-expr/src/lib.rs, add the following function:
fn foo() -> DataType {
  todo!()
}
  1. Ask rust-analyzer to import DataType for you: Image
  2. Suggestion is wrong, it's not visibile to us here, it suggests something else:
    Image
  3. Suggestion is still wrong, it finally gets a public symbol:
    Image

rust-analyzer version: rust-analyzer version: 0.4.2148-standalone (418c136 2024-10-15)

rustc version: rustc 1.83.0-nightly (ed04567 2024-09-28)

editor or extension: VS Code

repository link (if public, optional): https://github.com/polar-rs/polars

Metadata

Metadata

Assignees

Labels

C-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions