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.