Skip to content
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

Unintuitive behavior when both features and package are specified #8368

Closed
kornelski opened this issue Jun 16, 2020 · 2 comments
Closed

Unintuitive behavior when both features and package are specified #8368

kornelski opened this issue Jun 16, 2020 · 2 comments
Labels
C-bug Category: bug

Comments

@kornelski
Copy link
Contributor

kornelski commented Jun 16, 2020

If I have a workspace:

Cargo.toml
foo/Cargo.toml

and run in the root of the workspace:

cargo build -p foo --features=bar

Cargo fails with an error #7742:

error: --features is not allowed in the root of a virtual workspace

while

cd foo
cargo build --features=bar

is accepted. It's surprising that specifying -p is not equivalent to building in that package's directory.

I expected that when -p points to a specific package, Cargo wouldn't try to use non-existent features from the root manifest (#4942), but instead look for the features in that package's own manifest.

@kornelski kornelski added the C-bug Category: bug label Jun 16, 2020
@ehuss
Copy link
Contributor

ehuss commented Jun 16, 2020

There is a solution for this implemented via -Zpackage-features (#5364). cargo build -p foo --features bar -Zpackage-features should work.

@kornelski
Copy link
Contributor Author

Perfect! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants