Difference between running `cargo run -p` and `cargo run --bin` when running from workspace?

Hi,

I'm having a complex project with a root folder, a Cargo.toml defining a workspace, and a few crates.

Two crates have features that aren't activated by default, only in one of the crates they are.

When I try to run one of the sub-crates (a binary) with cargo run --bin ... from the workspace folder, the feature is activated, compilation fails.

If I run cargo run -p .. from the workspace folder, compilation succeeds. This seems rather confusing ...

Does anyone have a hint?

Best,
N

This is a quirk of Cargo:

2 Likes