Skip to content

consumer-setup: rules_rust patches go upstream or into rules_dx code, consumers get none (part of #11387) #11399

Open

Description

@TrapsterDK

Part of #11387. After the #11387 first slice, rules_dx depends on BCR rules_rust 0.75.0 and its 9 patches are a root-only single_version_override again. A consumer gets unpatched rules_rust. Each patch needs an upstream release or a fix in rules_dx code.

Where

  • MODULE.bazel:8-24 rules_rust single_version_override, patches under patches/rules_rust/
  • patches/README.md rules_rust row (the why of each patch)
  • Consumer tests that run Rust: tools/testing/hermetic/consumers/{cpp_rust,rust_wasi,adopt_android}

Fix

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hwH5AS7ytCaBAYwEtU

Activity

  1. added
    P2Improve and finish existing features
    model:sonnetAgent lane: scoped change with stated design, Sonnet
    on Nov 10, 2026
  2. TrapsterDK commented on Nov 10, 2026

    @TrapsterDK
    CollaboratorAuthor

    PR #11423 classifies the patches in the README and posts the table on #11387. Remaining: #11411 (rust_lld_msvc_libpath), #11412 (exec_cc_toolchain_env), #11414 (pdb/lazy host tools/cargo_toml_env_vars measurement and fix); upstream PRs to draft for six patches (list on #11387). Pre-existing: //core/modules:lang_json_test fails on generated languages.json/langs.bzl.

  3. TrapsterDK commented on Nov 12, 2026

    @TrapsterDK
    CollaboratorAuthor

    Upstream status of patches/rules_rust/:

    Patch Upstream
    clippy_metadata_inputs issue bazelbuild/rules_rust#4379, PR bazelbuild/rules_rust#4380 (open)
    pipelined_rmeta_path issue bazelbuild/rules_rust#4389, PR bazelbuild/rules_rust#4390 (open)
    static_archive_link_arg PR bazelbuild/rules_rust#3993 (open, by another author)
    msvc_pdb_output issue bazelbuild/rules_rust#4419, PR bazelbuild/rules_rust#4421 (new)
    exec_scope_universal issue bazelbuild/rules_rust#4420, PR bazelbuild/rules_rust#4422 (new, also covers extra_exec_rustc_env)
    cargo_toml_env_vars_flag not filed: adds a public flag, so it needs an issue to agree on the design first
    crate_universe_lazy_host_tools not filed
    cargo_build_script_no_coverage not filed: a regression test needs an Apple toolchain

    Already merged upstream: rust_lld_msvc_libpath (bazelbuild/rules_rust#4396) and the MSVC stdlib link flags (bazelbuild/rules_rust#4376). Still open: bazelbuild/rules_rust#4388 (exec cc toolchain env) and bazelbuild/rules_rust#4386 (crate_universe root lookup).

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01Xut2i1LBYg969L4ZJRMURT

  4. TrapsterDK commented on Nov 13, 2026

    @TrapsterDK
    CollaboratorAuthor

    #11414 static reading of unpatched rules_rust 0.75.0 (source only; no consumer or Windows run, those need CI):

    • msvc_pdb_output: default strip_level is dbg/fastbuild none, opt debuginfo (rust/private/toolchain.bzl:902). Unpatched, only -c opt MSVC bin/cdylib lose the declared .pdb; rustc still writes it as an undeclared file. Expected effect: no build failure, .pdb missing from opt outputs and remote results. rules_dx cannot fix it from its own MODULE.bazel: rust.toolchain tags are honoured only in the root module (rust/extensions.bzl:55), so a rules_dx-side fix has to go through the consumer root setup (MSVC-only strip_level opt = none, output-equivalent since MSVC ignores -Cstrip).
    • crate_universe_lazy_host_tools: for a non-root module repin is always False, yet _get_host_cargo_rustc runs unconditionally, so every consumer fetches rust_host_tools (cargo + rustc) for rules_dx's dx_crates, dx_quality_crates, dx_thrift_crates hubs. Fetch only, no failure. No rules_dx-side switch exists; upstream only.
    • cargo_toml_env_vars_flag: crate.from_cargo has generate_cargo_toml_env_vars (default True, crate_universe/extensions.bzl:1645), which rules_dx could set to False on its hubs (cargo-bazel-lock.json checksum then changes). That does not remove the extractor fetch for every consumer: the vendored BUILD files of rules_rust_wasm_bindgen (rrwbd, 175), rules_rust_prost (rrprd, 105) and rules_rust rrra (34) also declare cargo_toml_env_vars, so rust_wasi-style consumers still fetch it unpatched. Upstream flag remains the only full fix.
  5. TrapsterDK commented on Nov 17, 2026

    @TrapsterDK
    CollaboratorAuthor

    Unpatched rules_rust measurement, round 2 (branch issue-11414-unpatched-rules-rust d245c6d, without msvc_pdb_output and crate_universe_lazy_host_tools):

    • 43999855772 linux: //tools/testing/hermetic:rust_wasi PASSED. :cpp_rust TIMEOUT at 600.6s (consumer_qualifies_without_installs_or_network), no rust_host_tools error in the log, so not yet attributable.
    • 43999860391 windows --config=dx_build_release build of //cli/cli:dx and :dx_pdb: success. Unpatched opt build does not fail.
    • 43999864821 windows //cli/cli:dx_opt_pdb_test: analysis error 'OutputGroupInfo' value has no field or method 'pdb_file'. Unpatched opt build drops the .pdb output group.

    Round 3 (cpp_rust only, test_timeout=1800): 44004546195 control on main, 44004555664 on the branch. Equal outcome means the timeout is the 600s budget, not lazy_host_tools.

    Remaining:

  6. TrapsterDK commented on Nov 17, 2026

    @TrapsterDK
    CollaboratorAuthor

    #11414 results: lazy_host_tools and cargo_toml_env_vars_flag do not change the consumer fetch set (44004546195 vs 44004555664 green); msvc_pdb_output absence only drops the pdb_file output group (43999860391, 43999864821). All three marked root-only in #12949.

  7. TrapsterDK commented on Nov 17, 2026

    @TrapsterDK
    CollaboratorAuthor

    Status 2026-11-17: BCR rules_rust latest is still 0.75.0; every patch is root-only or has a rules_dx consumer fix. Remaining needs action outside devhusdk/rules_dx: file upstream issues/PRs for cargo_toml_env_vars_flag, crate_universe_lazy_host_tools, cargo_build_script_no_coverage, windows_exec_foreign_target_cc_linker, crate_universe_module_labels, and land bazelbuild/rules_rust#4390, #3993, #4421, #4422, #4388, #4386 (#4380 merged). Then bump to the first BCR release containing them and drop those patches.

  8. TrapsterDK commented on Nov 18, 2026

    @TrapsterDK
    CollaboratorAuthor

    Upstream status for the patches still without an upstream issue or PR (checked against #4390, #3993, #4421, #4422, #4388, #4386: none of them covers these):

    Assisted by Claude.

  9. TrapsterDK commented on Nov 18, 2026

    @TrapsterDK
    CollaboratorAuthor

    #13481 points the Upstream headers at bazelbuild/rules_rust#4433, #4436, #4438/#4331, #4437. Remaining (upstream only): land #4390, #3993, #4421, #4422, #4388, #4386, #4433, #4434, #4436, #4438; maintainer reply on #4437; Windows run before filing windows_exec_foreign_target_cc_linker; then bump rules_rust to the first BCR release with them and drop the patches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Improve and finish existing featuresmodel:sonnetAgent lane: scoped change with stated design, Sonnet

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions