Skip to content

Suggested imports suggest dev-deps when re-exports are avail in regular dependency #20286

@drahnr

Description

@drahnr

RA server suggest imports from [dev-dependencies] in non-test scopes. It also shadows alternative import paths of the same type via a different import path.

The sample code has instructions in crates/a/src/lib.rs.

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
Doesn't seem to work 🤷 ``

rustc version: (eg. output of rustc -V)
rustc 1.88.0 (6b00bc388 2025-06-23)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)

Version: 1.96.4
Commit: cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba
Date: 2025-01-16T00:16:19.038Z
Electron: 32.2.6
ElectronBuildId: 10629634
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Linux x64 6.15.6-100.fc41.x86_64

Identical issue on zed:

Zed: v0.195.5 (Zed)
OS: Linux Wayland fedora 41
Memory: 30.1 GiB
Architecture: x86_64
GPU: AMD Radeon Graphics (RADV REMBRANDT) || radv || Mesa 25.0.7

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

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

MVE https://github.com/drahnr/bug-zed-rust-completion

code snippet to reproduce:

See above

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions