Skip to content

Add support for --features and --no-default-features flags in workspace builds #4753

Closed
@newpavlov

Description

@newpavlov

When using cargo cmd --all --no-default-features on virtual manifest cargo should disable default features for all crates in the workspace. cargo cmd --all --features feature1,feature2 should enable feature if crate in the workspace has it and ignore it otherwise.

Old issue text:
In RustCrypto/hashes xargo is used in CI to verify if all crates are indeed no_std. But with the addition of std feature (see branch digest_v0.8) which per convention is enabled by default, xargo does not work correctly anymore. I've changed CI config to use the following command on workspace (Travis build):

xargo build --all --no-default-features --verbose --target armv7-unknown-linux-gnueabihf

But it fails with this error:

error[E0463]: can't find crate for `std`
  |
  = note: the `armv7-unknown-linux-gnueabihf` target may not be installed

It looks like that problem originates from the fact that cargo does not propagate --no-default-features when it builds all crates in workspace. In this particular case it causes digest (and all other crates) to be built with enabled std feature which is quite undesirable.

Is this behaviour intentional? In my opinion this flag (and others?) should be propagated to all crates in the workspace on which subcommand is called.

Old xargo issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-featuresArea: features — conditional compilationC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions