Description
Problem
I've found myself in a situation where I want to
- Build multiple packages in a single
cargo
invocation - Pass
rustc
flags on the command-line
The former works with cargo build
, e.g. cargo build -p foo -p bar
.
However, cargo build
only lets you specify flags with RUSTFLAGS
, which has different semantics than flags passed by cargo rustc
: RUSTFLAGS
are applied to all dependencies, not just the top-level package being built.
Proposed Solution
Change cargo rustc
to accept multiple packages using the -p
flag, matching cargo build
, cargo check
, etc.
Notes
Limiting cargo rustc
to a single package was intentional in the original cargo rustc
PR. This may be because no one was asking for multi-package support at the time?
I've implemented multi-package support in a local checkout and it seems to work fine. I'd be happy to work with the team on a PR (with updated tests, etc) if you're open to it!