-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-idegeneral IDE featuresgeneral IDE featuresA-project-modelproject model and workspace related issuesproject model and workspace related issuesC-bugCategory: bugCategory: bug
Description
When two workspaces share a dependency, rust-analyzer is unable to find all uses of functions defined in the dependency and used in both workspaces.
This happens because the dependency is duplicated in the crate graph. When rust-analyzer goes to find in which crate the function is defined, it looks at the crate graph and just picks the first crate that matches.
Then it looks at the dependants of that crate and finds only one of the workspaces (because the crate was not deduplicated).
Deduplication was initially introduced here #14476 as an optimization and then later removed again #18080 because it broke uses of CARGO_RUSTC_CURRENT_DIR
.
It looks like a difficult problem to solve. The two solutions that I can think of are these:
- Make sure that all analyses work correctly with duplicate crates in the crate graph.
- Deduplicate the crates anyway and generate the
CARGO_RUSTC_CURRENT_DIR
env var only at macro expansions?
Metadata
Metadata
Assignees
Labels
A-idegeneral IDE featuresgeneral IDE featuresA-project-modelproject model and workspace related issuesproject model and workspace related issuesC-bugCategory: bugCategory: bug