-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Problem
If you have a package foo
in your workspace, and it is not the default build target (cargo build
builds bar
), you build it via cargo build -p foo
. Now, if you want to enable a feature, the intuitive approach would be to cargo build -p foo --features new-feat
. This will cause an error if bar
doesn't have such feature, but it will build just fine if bar
also has the new-feat
feautre.
This is immensly confusing, as the feature is enabled for a package which one isn't even attempting to build. The solution is to, of course, invoke cargo build -p foo --features "foo/new-feat"
, but finding out about this is not trivial.
Proposed Solution
Emit a warning when running cargo build -p MEMBER --features FEATURE
if both MEMBER
and the root package have this feature declared.
Notes
If this is deemed useful, I can tackle the implementation.