You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Rust adapter: cargo -p NAME is ambiguous when a dependency shares a member's name #224
When a dependency has the same name as a workspace member, which is common when a crate depends on an older release of itself, Cargo rejects a bare -p NAME:
$ cargo test -p dup
error: specification `dup` is ambiguous
help: re-run this command with one of the following specifications
[email protected][email protected]
The adapter uses the bare name in two places:
cargoFeatureResolver runs cargo tree -p NAME. It fails, so when features vary, the whole repository falls back with Cargo feature resolution is unavailable.
testPackages holds the bare name, so when features don't vary, the planner writes cargo test -p dup, and that command errors out instead of running the tests.
Found on a real workspace: rust-cli/anstyle has dev-dependencies on published anstyle/anstyle-parse (found while working on #131).
Repro: a workspace with members dup (0.2.0) and app, where dup depends on old = { package = "dup", git = "file:///…" } (0.1.0). rustAdapter.analyze maps dup/src/lib.rs to dup, and the generated cargo test -p dup fails as above. cargo test -p [email protected] and cargo tree -p [email protected] both work.
Fix: give a member whose name another package also uses the spec NAME@VERSION, everywhere the adapter hands a name to Cargo (test packages and feature units). Let the planner accept [email protected][-pre], which stays a literal argument (no ranges, no +build, no spaces). If a dependency has the same name and version, fall back with a new documented reason.
Activity