fix: set CARGO env var during rustc -vV probe#16811
fix: set CARGO env var during rustc -vV probe#16811weihanglo merged 2 commits intorust-lang:masterfrom
Conversation
|
r? @epage rustbot has assigned @epage. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
Thanks for the contribution. We expect a new test to be written for new behavior. We've also found it helpful to add the tests in a commit before the fix, reproducing the problem. See a working-in-progress note from epage: https://epage.github.io/dev/pr-style/#c-test
Add a test that verifies whether the CARGO env var is set when the rustc wrapper is invoked during the -vV version probe. Currently it is not set, which causes tools like sccache to fail when RUSTC_WORKSPACE_WRAPPER is also present. See rust-lang#16805
The -vV probe goes through RUSTC_WRAPPER and RUSTC_WORKSPACE_WRAPPER since rust-lang#13659, but the CARGO env var was not set. Tools like sccache depend on CARGO to detect the workspace wrapper pattern in their compiler detection logic. Closes rust-lang#16805
40bcbe9 to
e794ef7
Compare
|
Updated with two commits per C-TEST convention:
The test uses a custom wrapper that writes CARGO env var status to a file when invoked for |
Update cargo submodule 12 commits in 888f675344eb1cf2308fd53183e667bdd2c58e51..0c7d80bf5ad3b873a5dbf44e0185152890c6d18a 2026-03-30 16:59:25 +0000 to 2026-04-02 20:48:06 +0000 - refactor(network): use async for registry network operations (rust-lang/cargo#16745) - fix(compile): Don't hide hard warnings with build.warnings=allow (rust-lang/cargo#16827) - chore: Upgrade incompatible dependencies (rust-lang/cargo#16825) - fix(compile): build.warnings=allow should not hide denied diagnostics (rust-lang/cargo#16824) - fix(install): Ignore resolver.lockfile-path (rust-lang/cargo#16823) - chore(deps): update compatible (rust-lang/cargo#16820) - refactor(compile): Consolidate output options (rust-lang/cargo#16821) - refactor: Export public dependencies from internal crates (rust-lang/cargo#16819) - refactor(progress): Make the code more approachable (rust-lang/cargo#16813) - Simplified build script bin names in new layout (rust-lang/cargo#16812) - fix: set CARGO env var during rustc -vV probe (rust-lang/cargo#16811) - Split out `cargo-util-terminal` (rust-lang/cargo#16809) r? ghost
Update cargo submodule 15 commits in 888f675344eb1cf2308fd53183e667bdd2c58e51..a357df4c26fc14514e66aae2a269456b5545c7db 2026-03-30 16:59:25 +0000 to 2026-04-03 16:47:15 +0000 - chore: downgrade to libz-sys@1.1.24 (rust-lang/cargo#16833) - feat: add frame-pointers profile option (rust-lang/cargo#16742) - upgrade to gix@0.81.0 (rust-lang/cargo#16828) - refactor(network): use async for registry network operations (rust-lang/cargo#16745) - fix(compile): Don't hide hard warnings with build.warnings=allow (rust-lang/cargo#16827) - chore: Upgrade incompatible dependencies (rust-lang/cargo#16825) - fix(compile): build.warnings=allow should not hide denied diagnostics (rust-lang/cargo#16824) - fix(install): Ignore resolver.lockfile-path (rust-lang/cargo#16823) - chore(deps): update compatible (rust-lang/cargo#16820) - refactor(compile): Consolidate output options (rust-lang/cargo#16821) - refactor: Export public dependencies from internal crates (rust-lang/cargo#16819) - refactor(progress): Make the code more approachable (rust-lang/cargo#16813) - Simplified build script bin names in new layout (rust-lang/cargo#16812) - fix: set CARGO env var during rustc -vV probe (rust-lang/cargo#16811) - Split out `cargo-util-terminal` (rust-lang/cargo#16809)
Update cargo submodule 15 commits in 888f675344eb1cf2308fd53183e667bdd2c58e51..a357df4c26fc14514e66aae2a269456b5545c7db 2026-03-30 16:59:25 +0000 to 2026-04-03 16:47:15 +0000 - chore: downgrade to libz-sys@1.1.24 (rust-lang/cargo#16833) - feat: add frame-pointers profile option (rust-lang/cargo#16742) - upgrade to gix@0.81.0 (rust-lang/cargo#16828) - refactor(network): use async for registry network operations (rust-lang/cargo#16745) - fix(compile): Don't hide hard warnings with build.warnings=allow (rust-lang/cargo#16827) - chore: Upgrade incompatible dependencies (rust-lang/cargo#16825) - fix(compile): build.warnings=allow should not hide denied diagnostics (rust-lang/cargo#16824) - fix(install): Ignore resolver.lockfile-path (rust-lang/cargo#16823) - chore(deps): update compatible (rust-lang/cargo#16820) - refactor(compile): Consolidate output options (rust-lang/cargo#16821) - refactor: Export public dependencies from internal crates (rust-lang/cargo#16819) - refactor(progress): Make the code more approachable (rust-lang/cargo#16813) - Simplified build script bin names in new layout (rust-lang/cargo#16812) - fix: set CARGO env var during rustc -vV probe (rust-lang/cargo#16811) - Split out `cargo-util-terminal` (rust-lang/cargo#16809)
Update cargo submodule 15 commits in 888f675344eb1cf2308fd53183e667bdd2c58e51..a357df4c26fc14514e66aae2a269456b5545c7db 2026-03-30 16:59:25 +0000 to 2026-04-03 16:47:15 +0000 - chore: downgrade to libz-sys@1.1.24 (rust-lang/cargo#16833) - feat: add frame-pointers profile option (rust-lang/cargo#16742) - upgrade to gix@0.81.0 (rust-lang/cargo#16828) - refactor(network): use async for registry network operations (rust-lang/cargo#16745) - fix(compile): Don't hide hard warnings with build.warnings=allow (rust-lang/cargo#16827) - chore: Upgrade incompatible dependencies (rust-lang/cargo#16825) - fix(compile): build.warnings=allow should not hide denied diagnostics (rust-lang/cargo#16824) - fix(install): Ignore resolver.lockfile-path (rust-lang/cargo#16823) - chore(deps): update compatible (rust-lang/cargo#16820) - refactor(compile): Consolidate output options (rust-lang/cargo#16821) - refactor: Export public dependencies from internal crates (rust-lang/cargo#16819) - refactor(progress): Make the code more approachable (rust-lang/cargo#16813) - Simplified build script bin names in new layout (rust-lang/cargo#16812) - fix: set CARGO env var during rustc -vV probe (rust-lang/cargo#16811) - Split out `cargo-util-terminal` (rust-lang/cargo#16809)
Update cargo submodule 15 commits in 888f675344eb1cf2308fd53183e667bdd2c58e51..a357df4c26fc14514e66aae2a269456b5545c7db 2026-03-30 16:59:25 +0000 to 2026-04-03 16:47:15 +0000 - chore: downgrade to libz-sys@1.1.24 (rust-lang/cargo#16833) - feat: add frame-pointers profile option (rust-lang/cargo#16742) - upgrade to gix@0.81.0 (rust-lang/cargo#16828) - refactor(network): use async for registry network operations (rust-lang/cargo#16745) - fix(compile): Don't hide hard warnings with build.warnings=allow (rust-lang/cargo#16827) - chore: Upgrade incompatible dependencies (rust-lang/cargo#16825) - fix(compile): build.warnings=allow should not hide denied diagnostics (rust-lang/cargo#16824) - fix(install): Ignore resolver.lockfile-path (rust-lang/cargo#16823) - chore(deps): update compatible (rust-lang/cargo#16820) - refactor(compile): Consolidate output options (rust-lang/cargo#16821) - refactor: Export public dependencies from internal crates (rust-lang/cargo#16819) - refactor(progress): Make the code more approachable (rust-lang/cargo#16813) - Simplified build script bin names in new layout (rust-lang/cargo#16812) - fix: set CARGO env var during rustc -vV probe (rust-lang/cargo#16811) - Split out `cargo-util-terminal` (rust-lang/cargo#16809)
Update cargo submodule 15 commits in 888f675344eb1cf2308fd53183e667bdd2c58e51..a357df4c26fc14514e66aae2a269456b5545c7db 2026-03-30 16:59:25 +0000 to 2026-04-03 16:47:15 +0000 - chore: downgrade to libz-sys@1.1.24 (rust-lang/cargo#16833) - feat: add frame-pointers profile option (rust-lang/cargo#16742) - upgrade to gix@0.81.0 (rust-lang/cargo#16828) - refactor(network): use async for registry network operations (rust-lang/cargo#16745) - fix(compile): Don't hide hard warnings with build.warnings=allow (rust-lang/cargo#16827) - chore: Upgrade incompatible dependencies (rust-lang/cargo#16825) - fix(compile): build.warnings=allow should not hide denied diagnostics (rust-lang/cargo#16824) - fix(install): Ignore resolver.lockfile-path (rust-lang/cargo#16823) - chore(deps): update compatible (rust-lang/cargo#16820) - refactor(compile): Consolidate output options (rust-lang/cargo#16821) - refactor: Export public dependencies from internal crates (rust-lang/cargo#16819) - refactor(progress): Make the code more approachable (rust-lang/cargo#16813) - Simplified build script bin names in new layout (rust-lang/cargo#16812) - fix: set CARGO env var during rustc -vV probe (rust-lang/cargo#16811) - Split out `cargo-util-terminal` (rust-lang/cargo#16809)
Update cargo submodule 15 commits in 888f675344eb1cf2308fd53183e667bdd2c58e51..a357df4c26fc14514e66aae2a269456b5545c7db 2026-03-30 16:59:25 +0000 to 2026-04-03 16:47:15 +0000 - chore: downgrade to libz-sys@1.1.24 (rust-lang/cargo#16833) - feat: add frame-pointers profile option (rust-lang/cargo#16742) - upgrade to gix@0.81.0 (rust-lang/cargo#16828) - refactor(network): use async for registry network operations (rust-lang/cargo#16745) - fix(compile): Don't hide hard warnings with build.warnings=allow (rust-lang/cargo#16827) - chore: Upgrade incompatible dependencies (rust-lang/cargo#16825) - fix(compile): build.warnings=allow should not hide denied diagnostics (rust-lang/cargo#16824) - fix(install): Ignore resolver.lockfile-path (rust-lang/cargo#16823) - chore(deps): update compatible (rust-lang/cargo#16820) - refactor(compile): Consolidate output options (rust-lang/cargo#16821) - refactor: Export public dependencies from internal crates (rust-lang/cargo#16819) - refactor(progress): Make the code more approachable (rust-lang/cargo#16813) - Simplified build script bin names in new layout (rust-lang/cargo#16812) - fix: set CARGO env var during rustc -vV probe (rust-lang/cargo#16811) - Split out `cargo-util-terminal` (rust-lang/cargo#16809)
Update cargo submodule 15 commits in 888f675344eb1cf2308fd53183e667bdd2c58e51..a357df4c26fc14514e66aae2a269456b5545c7db 2026-03-30 16:59:25 +0000 to 2026-04-03 16:47:15 +0000 - chore: downgrade to libz-sys@1.1.24 (rust-lang/cargo#16833) - feat: add frame-pointers profile option (rust-lang/cargo#16742) - upgrade to gix@0.81.0 (rust-lang/cargo#16828) - refactor(network): use async for registry network operations (rust-lang/cargo#16745) - fix(compile): Don't hide hard warnings with build.warnings=allow (rust-lang/cargo#16827) - chore: Upgrade incompatible dependencies (rust-lang/cargo#16825) - fix(compile): build.warnings=allow should not hide denied diagnostics (rust-lang/cargo#16824) - fix(install): Ignore resolver.lockfile-path (rust-lang/cargo#16823) - chore(deps): update compatible (rust-lang/cargo#16820) - refactor(compile): Consolidate output options (rust-lang/cargo#16821) - refactor: Export public dependencies from internal crates (rust-lang/cargo#16819) - refactor(progress): Make the code more approachable (rust-lang/cargo#16813) - Simplified build script bin names in new layout (rust-lang/cargo#16812) - fix: set CARGO env var during rustc -vV probe (rust-lang/cargo#16811) - Split out `cargo-util-terminal` (rust-lang/cargo#16809)
Update cargo submodule 15 commits in 888f675344eb1cf2308fd53183e667bdd2c58e51..a357df4c26fc14514e66aae2a269456b5545c7db 2026-03-30 16:59:25 +0000 to 2026-04-03 16:47:15 +0000 - chore: downgrade to libz-sys@1.1.24 (rust-lang/cargo#16833) - feat: add frame-pointers profile option (rust-lang/cargo#16742) - upgrade to gix@0.81.0 (rust-lang/cargo#16828) - refactor(network): use async for registry network operations (rust-lang/cargo#16745) - fix(compile): Don't hide hard warnings with build.warnings=allow (rust-lang/cargo#16827) - chore: Upgrade incompatible dependencies (rust-lang/cargo#16825) - fix(compile): build.warnings=allow should not hide denied diagnostics (rust-lang/cargo#16824) - fix(install): Ignore resolver.lockfile-path (rust-lang/cargo#16823) - chore(deps): update compatible (rust-lang/cargo#16820) - refactor(compile): Consolidate output options (rust-lang/cargo#16821) - refactor: Export public dependencies from internal crates (rust-lang/cargo#16819) - refactor(progress): Make the code more approachable (rust-lang/cargo#16813) - Simplified build script bin names in new layout (rust-lang/cargo#16812) - fix: set CARGO env var during rustc -vV probe (rust-lang/cargo#16811) - Split out `cargo-util-terminal` (rust-lang/cargo#16809)
Summary
Set the
CARGOenvironment variable when running therustc -vVversion probe, consistent with howCompilation::fill_env()sets it for all compilation invocations.Problem
Since #13659, the
-vVprobe goes throughRUSTC_WRAPPERandRUSTC_WORKSPACE_WRAPPER. However, theCARGOenv var is not set during this probe. Tools like sccache depend onCARGOto detect the workspace wrapper pattern in their compiler detection logic (mozilla/sccache#1280), causingsccacheto fail with "Compiler not supported" when aRUSTC_WORKSPACE_WRAPPERis present.Solution
Add
cmd.env(crate::CARGO_ENV, gctx.cargo_exe()?)before the-vVinvocation inRustc::new().Test plan
rustc_wrappertests pass (8/8)CARGO=$(which cargo)as a workaround resolves the issueCloses #16805