fix: exclude CARGO_ENCODED_RUSTFLAGS from env var hash#2651
Merged
Xuanwo merged 1 commit intomozilla:mainfrom Mar 25, 2026
Merged
fix: exclude CARGO_ENCODED_RUSTFLAGS from env var hash#2651Xuanwo merged 1 commit intomozilla:mainfrom
CARGO_ENCODED_RUSTFLAGS from env var hash#2651Xuanwo merged 1 commit intomozilla:mainfrom
Conversation
This was referenced Mar 24, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2651 +/- ##
=======================================
Coverage 73.38% 73.38%
=======================================
Files 68 68
Lines 37338 37340 +2
=======================================
+ Hits 27400 27402 +2
Misses 9938 9938 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
For normal crate compilations, cargo consumes CARGO_ENCODED_RUSTFLAGS and passes the flags as command-line arguments to rustc. They are already hashed as part of the argument list (step 3), so hashing the env var is redundant. For build-script probe compilations (like proc-macro2's autocfg probes), the build script inherits the env var but does NOT pass those flags to its probe rustc invocation. The flags are irrelevant to the probe's output. Even if they passes it, it will then be in the argument list. In both cases, the env var value may contain build-specific paths, for example, `--remap-path-prefix=/random/build/path=...`. Those may cause unnecessary cache misses across builds.
12ca78f to
50e2399
Compare
Contributor
Author
|
The failure doesn't look related to my change https://github.com/mozilla/sccache/actions/runs/23541569356/job/68531339909?pr=2651 🤔 |
Collaborator
|
Yes, I think they are not related. Merged! |
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.
For normal crate compilations, cargo consumes
CARGO_ENCODED_RUSTFLAGSand passes the flags as command-line arguments to rustc. They are already hashed as part of the argument list (step 3), so hashing the env var is redundant.For build-script probe compilations (like proc-macro2's autocfg probes), the build script inherits the env var but does NOT pass those flags to its probe rustc invocation. The flags are irrelevant to the probe's output. Even if they passes it, it will then be in the argument list.
In both cases, the env var value may contain build-specific paths, for example,
--remap-path-prefix=/random/build/path=.... Those may cause unnecessary cache misses across builds.While we have #2494 and #2495, I think this is less controversial so posted it separately