cargo
cargo copied to clipboard
Add the ability to rename a crate inherited from the workspace
Problem
Consider the following part with workspace dependencies from root Cargo.toml:
[workspace.dependencies]
itoa = "1"
itoa-old = { version = "0.4", package = "itoa" }
And parts with dependencies from 2 workspace members:
# member-1/Cargo.toml
[dependencies]
itoa.workspace = true
# member-2/Cargo.toml
[dependencies]
itoa = { workspace = true, package = "itoa-old" }
Before checking/compiling member-2, Cargo prints this warning:
warning: /home/user/ws/member-2/Cargo.toml: unused manifest key: dependencies.itoa.package
And hence ignores the package key from member-2's Cargo.toml.
So, unless I missed something in the documentation, Cargo can't rename dependencies inherited from the workspace.
Proposed Solution
Make Cargo read the package key in inherited dependencies, and rename them as it does with usual dependencies.
Notes
No response