cargo add
should support adding an inherited dependency to a workspace
#13810
Labels
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-triage
Status: This issue is waiting on initial triage.
Problem
We are using a workspace to centrally managed certificate configuration including dependencies. This makes it easier to ship some - perhaps all - workspace packages on separate schedules with approved dependency versions (likely the latest minor or patch version). Unfortunately,
cargo add
- which we expect most crate developers will use - cannot add a dependency to a workspace.If our workspace is
Cargo.toml
and member crates are undersdk/
e.g.,sdk/core/Cargo.toml
, what should happen somehow is:Cargo.toml
under[workspace.dependencies]
.name = { workspace = inherit }
is added to whatever dependency section is chosen e.g.,[workspace]
by default or[dev-dependencies]
when--dev
is specified.Proposed Solution
Ideally,
cargo add
just works without additional command line switches. This makes it easier in a monorepo with many different contributing teams that don't have to think about different paradigms than they are used to. Perhaps some configuration in.cargo/config.toml
e.g.,If lieu of or even in addition to, it seems that
cargo add {dependency} --package {package} --manifest-path {workspace cargo.toml}
should do this. Currently it does not, and seems to ignore the--manifest-path
. If I don't use--package
and use just--manifest-path
, I get an error:Notes
May be related to #12208.
The text was updated successfully, but these errors were encountered: