-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add default
features for each [[bin]]
#10409
Comments
Sorry, I don't get it. Where can I specify required dependencies for a Presumably you want to build the binary without specifying features in CLI, there is a similar feature request you might be interested in, which proposes to enable required features automatically: #4663 |
That issue is about enabling required dependencies. I’m talking about “recommended”, default dependencies, as those in |
Sorry @Icelk, I've searched the key Also, I am a bit confused. Is this issue concerning features or dependencies? They are not interchangeable terms in Cargo.toml. AFAIK, a target like Here is my bold guess about what you mean by "recommended". Correct me if I am wrong. # ...
[[bin]]
name = "foo"
default-features = ["serde", "log"] In Cargo.toml, there is a bin target Is this what in your mind? |
Precisely! As you mentioned, one could specify both dependencies and other features in the |
Discussion in #1982 cover some of scenarios here. rust-lang/rfcs#3374 is an attempt to resolve this as well. |
Triage: after a re-read. This is kinda a duplicate of #4663, and is covered by #1982 and rust-lang/rfcs#3374, especially the latter that automatically enabling features for target requested. Let's continue discussing there. Thank you for your report :) |
Thanks for the links! |
Problem
When adding [[bin]] entries to a
Cargo.toml
, you can specify required dependencies, but not additional "recommended", default features.Proposed Solution
Add a key, namely
default-features
to the [[bin]] sections inCargo.toml
.Both the
dependencies.default
and this new key would be applied. If--no-default-features
is passed, both declarations are ignored.Notes
No response
The text was updated successfully, but these errors were encountered: