Description
Describe the problem you are trying to solve
Currently tools like clippy, miri and rls run cargo
via the command line and then try to reconstruct the rustc
invocation for the final crate in order to run custom code just for the final crate. Clippy and miri inject a custom driver via the RUSTC
env var. During execution of the driver, the driver decides whether it is being invoked for a dependency or for the final crate and then either runs rustc
or its own code. Rls runs the full cargo command with rustc
, but keeps reinvoking rustc
on the final crate.
Futhermore, running cargo check && cargo clippy && cargo check
will rebuild all dependencies and the final crate 3 times, even though the latter two calls should just be fetching data from the incremental cache and essentially be nops.
Describe the solution you'd like
I'm currently considering the following two options:
- add a flag that one can pass to any cargo subcommand which will, instead of running the compiler, just emit the commands to be invoked in the order in which they are supposed to be invoked.
- add a flag that allows
cargo check
andcargo rustc
to replace only the finalrustc
invocations with a custom driver without causing a rebuild of all dependencies when switching from regularcargo check
invocations.
Notes
I'm fine with doing this experimentally by only allowing it on nightly cargo
.