rust-lang / rust-lang/rust-analyzer
Suggested imports suggest dev-deps when re-exports are avail in regular dependency
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction instructions in crates/a/src/lib.rs and the linked MVE. Reproduce the suggested imports in a non-test scope, then trace why a dev-dependency is selected and why an alternative re-export path is shadowed. Done when both incorrect suggestions are resolved and the reproduction behaves correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100