Skip to content

Support rustc incremental compilation via persistent workers - #4184

Draft
anguslees wants to merge 1 commit into
bazelbuild:mainfrom
anguslees:gus/persistent-rustc-workers
Draft

Support rustc incremental compilation via persistent workers#4184
anguslees wants to merge 1 commit into
bazelbuild:mainfrom
anguslees:gus/persistent-rustc-workers

Conversation

@anguslees

@anguslees anguslees commented Jul 31, 2026

Copy link
Copy Markdown

Summary

  • add protobuf persistent-worker support directly to process_wrapper
  • add an opt-in --@rules_rust//rust/settings:experimental_persistent_worker=true setting
  • reuse request-namespaced rustc incremental state for non-optimized builds
  • keep process-wrapper flags in worker startup arguments and materialize each flat WorkRequest as one rustc param file
  • preserve nested rustc response files and process-wrapper substitutions with an internal response-file marker
  • preserve one-shot execution for remote/non-worker executors and the rare opaque Args extension case

Related to #412. This is a worker-local alternative to the Bazel-managed incremental artifacts proposed in #3925.

Test plan

  • bazel test //util/process_wrapper:process_wrapper_test --@rules_rust//rust/settings:experimental_persistent_worker=true
  • bazel test //test/process_wrapper/... //test/unit/pipelined_compilation:pipelined_compilation_test_suite //test/unit/location_expansion:location_expansion_test_suite
  • worker and forced one-shot builds of //test/unit/location_expansion:mylibrary with nested response files
  • worker build with a response file supplied through extra_rustc_flag
  • bazel test --config=rustfmt //util/process_wrapper:process_wrapper_test
  • buildifier -mode=check rust/private/rust.bzl rust/private/rustc.bzl rust/settings/BUILD.bazel rust/settings/settings.bzl

AI assistance

Kilo Code assisted with rebasing the original implementation onto current main, compatibility review, and test iteration. I reviewed and own the resulting changes.

@anguslees anguslees changed the title Add persistent rustc workers Support rustc incremental compilation via persistent workers Jul 31, 2026
@anguslees

Copy link
Copy Markdown
Author

If you would rather I switch to using a protobuf library (and add more deps to the process wrapper), I can do that instead.

@anguslees
anguslees marked this pull request as draft July 31, 2026 02:33
Add protobuf persistent-worker support to process_wrapper and opt-in incremental compilation for non-optimized Rustc actions. Flatten rustc response files through worker requests while preserving process_wrapper substitutions, and retain one-shot execution for opaque Args actions.

Assisted-by: Kilo Code
@anguslees
anguslees force-pushed the gus/persistent-rustc-workers branch from 1e07811 to 9dfe42a Compare August 10, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant