cargo icon indicating copy to clipboard operation
cargo copied to clipboard

RUSTC_WRAPPER is ignored for `rustc -vV` call

Open RalfJung opened this issue 3 years ago • 0 comments

Problem

We are setting RUSTC_WRAPPER in order to intercept every invocation of rustc from cargo. However, it looks like cargo will call rustc -vV in any case, completely bypassing the RUSTC_WRAPPER env var. Only the RUSTC env var seems to be honored for the -vV call. This is causing us a bunch of pain right now since we need to figure out how to best intercept this -vV call.

The docs describe both RUSTC and RUSTC_WRAPPER in very similar terms, so I think this is clearly a bug -- both env vars should be effective for the same invocations.

We prefer to use RUSTC_WRAPPER over RUSTC because we need to intercept all things that cargo calls (including rustdoc, and running the actual binaries), and RUSTC_WRAPPER makes it easier to figure out what cargo called us for -- if we are invoked with the first argument being rustc, we know it was rustc that cargo wanted. (This is in the cargo-miri wrapper.)

RalfJung avatar Jul 21 '22 12:07 RalfJung