Permit library-only and binary-only dependencies #128220
Labels
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-cargo
Relevant to the cargo team, which will review and decide on the PR/issue.
Rust permits a package to contain both a library and a binary. However, any dependencies are necessarily shared, which is frequently undesirable. The only available alternative is to split the package in two, at which point the name (on crates.io) must be different.
My specific use case is avoiding deps like
clap
for anyone building a library, which adds needless overhead when building (even if only in non-incremental builds).How feasible would it be to have
[bin-dependencies]
and[lib-dependencies]
sections? These sections would extend the existing[dependencies]
for backwards compatibility. Alternatively, a dependency could be specified with{ bin = true, lib = false }
or similar.The text was updated successfully, but these errors were encountered: