Skip to content

RUSTC_WORKSPACE_WRAPPER tracking issue #8143

@ehuss

Description

@ehuss

RUSTC_WORKSPACE_WRAPPER was added in #7533, primarily for clippy support, but could be useful for others.

Differences from RUSTC_WRAPPER:

  • Only runs for workspace members.
  • Path is included in the filename hash (which ensures these artifacts are cached separately from usage without the wrapper).

You can test drive this with cargo clippy -Zunstable-options on the latest nightly.

One of the primary benefits is that now cargo clippy can share the same cache with cargo check for non-workspace members.

Before stabilizing, some things to consider:

  • Is this the right design?
  • This doesn't help with wrapping only specific crates (like just the "primary" ones). Sometimes people want to only have clippy lints for the "root" crate, or for specific crates specified on the command-line (Limit to specific package in workspace, also excluding its dependencies rust-clippy#3025). With this change for clippy, cargo clippy -p NAME only works for workspace members.
    • Cargo previously had an undocumented CARGO_PRIMARY_PACKAGE environment variable, perhaps something like that could be used?
    • How should tools like clippy handle -p non-member?
  • RUSTC_WORKSPACE_WRAPPER doesn't currently work with sccache. How difficult would this be to fix?
  • Some tools may want to use arguments with the wrapper. For example, my-tool wrapper would pass the "wrapper" argument to my-tool to tell it is in wrapper mode. Currently the env vars do not allow passing in arguments. Alternatively, Cargo could set some special env var to inform the executable that it is being used as a wrapper.

cc @yaahc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions