rust-lang / rust-lang/rust-analyzer
Explicitly select members in a workspace
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
If there is a workspace with multiple members (crate1, crate2) which use the same crate dependency (crate3) but crate1 uses a feature feature_a and crate2 doesn't, then rust-analyzer won't Identify code under #[cfg(not(feature = "feature_a"))], even though crate2 might use such code.
In order to solve this straightforwardly, it would be nice to have the option to either
- Make rust-analyzer discover only members in
default-members. - Define explicit members for rust-analyzer to discover, similar to the
rust-analyzer.linkedProjectssetting.
Example Cargo.toml:
[workspace]
resolver = "2"
members = [
"crate1",
"crate2",
]
default-members = [
"crate2"
]
[workspace.dependencies]
crate3 = { path = "crate3", default-features = false }
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 by reproducing the workspace shown in the issue and inspect rust-analyzer's workspace-member discovery and Cargo configuration handling. The work is complete when rust-analyzer can explicitly select discovered members, including the proposed default-members behavior, and cfg analysis reflects the selected members.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100