Allow opting out of cc toolchain for cargo_build_script - #3679
Closed
dzbarsky wants to merge 1 commit into
Closed
Conversation
dzbarsky
force-pushed
the
zbarsky/cc-build-script
branch
from
October 19, 2025 17:39
3956a95 to
0d6c5b8
Compare
dzbarsky
force-pushed
the
zbarsky/cc-build-script
branch
from
October 19, 2025 17:41
0d6c5b8 to
ce56648
Compare
codelinaro-mirror-sync Bot
pushed a commit
to CodeLinaro-mirror/la_platform_external_bazelbuild-rules_rust
that referenced
this pull request
Jul 25, 2026
This change introduces `use_cc_toolchain` to `cargo_build_script` which can be used to control whether or not a `cc_toolchain` is explicitly withheld from `CargoBuildScript` actions. Additionally a global flag `--@rules_rust//cargo/settings:use_cc_toolchain` can be used to control the default of any build script that has not either explicitly set `use_cc_toolchain = 1` (always include cc toolchains) or `use_cc_toolchain = 0` (always exclude cc toolchains). closes bazelbuild/rules_rust#3680 closes bazelbuild/rules_rust#3679 Co-authored-by: Krasimir Georgiev <krasimir@google.com>
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.
With a hermetic cc toolchain + sysroot, the
cc_toolchain.all_filescan be quite a lot of a files to add to the spawn inputs. Our monorepo shows around 15% of global analysis time spent onctx.actions.runofcargo_build_scriptdue to these inputs. This PR gives us a switch to remove the toolchain from build scripts that don't intend to use it, while keeping backwards-compatibility.