Skip to content

Support for custom drivers #6356

Open
Open
@oli-obk

Description

@oli-obk

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:

  1. 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.
  2. add a flag that allows cargo check and cargo rustc to replace only the final rustc invocations with a custom driver without causing a rebuild of all dependencies when switching from regular cargo check invocations.

Notes

I'm fine with doing this experimentally by only allowing it on nightly cargo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-build-executionArea: anything dealing with executing the compilerA-pluginsArea: extending cargoC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions