Handle use of RUSTC_WORKSPACE_WRAPPER#1280
Merged
drahnr merged 3 commits intomozilla:mainfrom Sep 15, 2022
Merged
Conversation
|
Works as expected with |
8cae00b to
479d7f8
Compare
Codecov Report
@@ Coverage Diff @@
## main #1280 +/- ##
==========================================
+ Coverage 29.60% 29.67% +0.07%
==========================================
Files 49 49
Lines 17246 17321 +75
Branches 8304 8333 +29
==========================================
+ Hits 5105 5140 +35
- Misses 6798 6808 +10
- Partials 5343 5373 +30
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
drahnr
reviewed
Aug 18, 2022
added 2 commits
September 5, 2022 20:26
Handle the scenario where cargo is being used with sccache as a RUSTC_WRAPPER and another tool is being used as a RUSTC_WORKSPACE_WRAPPER, by looking at whether rustc is the first argument. Signed-off-by: Tom Fay <tomfay@microsoft.com>
the wrapped rustc may not just be "rustc", it may have an extension or more path components
dc42976 to
3d85426
Compare
drahnr
requested changes
Sep 6, 2022
Contributor
Author
|
Thanks for the review - I've addressed the nits now. |
drahnr
approved these changes
Sep 6, 2022
Collaborator
|
If CI is passed, we're good to go! Thank you! |
|
CI is all green 🎉 |
10 tasks
We're just waiting on someone to push the "merge" button, right? |
tottoto
pushed a commit
to tottoto/sccache
that referenced
this pull request
Feb 6, 2026
Following implementation at flemosr/tonic-richer-error.
This was referenced Mar 30, 2026
github-merge-queue bot
pushed a commit
to rust-lang/cargo
that referenced
this pull request
Mar 31, 2026
## Summary Set the `CARGO` environment variable when running the `rustc -vV` version probe, consistent with how `Compilation::fill_env()` sets it for all compilation invocations. ## Problem Since #13659, the `-vV` probe goes through `RUSTC_WRAPPER` and `RUSTC_WORKSPACE_WRAPPER`. However, the `CARGO` env var is not set during this probe. Tools like sccache depend on `CARGO` to detect the workspace wrapper pattern in their compiler detection logic ([mozilla/sccache#1280](mozilla/sccache#1280)), causing `sccache` to fail with "Compiler not supported" when a `RUSTC_WORKSPACE_WRAPPER` is present. ## Solution Add `cmd.env(crate::CARGO_ENV, gctx.cargo_exe()?)` before the `-vV` invocation in `Rustc::new()`. ## Test plan - [x] Existing `rustc_wrapper` tests pass (8/8) - Manually verified: `CARGO=$(which cargo)` as a workaround resolves the issue Closes #16805
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1274
Handle the scenario where cargo is being used with sccache as a RUSTC_WRAPPER and another tool is being used as a
RUSTC_WORKSPACE_WRAPPER, by inspecting the first argument.
In this case
rustcwill be the first argument passed to the workspace wrapper, and therustcversion check will need to also do<wrapper> rustc -vVrather than<wrapper> -vV.As a precaution against inadvertently identifying a c compiler as a rustc workspace wrapper, I also checked for the presence of the CARGO env which cargo sets for all processes it runs.