Skip to content

Replace Rust toolchain trampolines with soldr #53

@zackees

Description

@zackees

Goal

Replace fbuild's hand-rolled Rust toolchain trampolines (`_cargo`, `_rustc`, `_rustfmt`, `ci/trampoline.py`) with calls to `soldr` v0.7.0.

soldr was designed to solve exactly this problem — it resolves toolchain binaries via `rustup which` so the correct rustup-managed binary is always used without PATH-munging. This removes ~140 lines of fbuild-specific trampoline code.

Scope

In scope — 1:1 behavior-preserving migration:

  • `_cargo` → `exec soldr --no-cache cargo "$@"`
  • `_rustc` → `exec soldr rustc "$@"`
  • `_rustfmt` → `exec soldr rustfmt "$@"`
  • `ci/trampoline.py::cargo/rustc/rustfmt/clippy_driver()` — call soldr instead of PATH-munging
  • `ci/trampoline.py::_run_cargo_bin()` (`run_fbuild`, `run_fbuild_daemon`) — route through `soldr --no-cache cargo run`
  • `ci/hooks/tool_guard.py` — accept `soldr ` as a valid prefix
  • Add `soldr>=0.7.0` to `ci/dev-tools` dependencies
  • Doc updates in `CLAUDE.md`, `CODEX.md`, `ci/dev-tools/README.md`, `ci/hooks/README.md`

Out of scope for this PR:

  • Dropping the `zccache>=1.2.11` Python dep (fbuild may still need it standalone)
  • Removing `ci/env.py::activate()` / `clean_env()` (legacy callers exist; leave for a later cleanup pass)
  • Adopting soldr's built-in zccache RUSTC_WRAPPER path (`soldr cargo` without `--no-cache`) — that's a deliberate "do we want a compilation cache?" decision, not a side-effect of this trampoline swap. Keeping `--no-cache` preserves existing build semantics.
  • Migrating ecosystem tools (`cargo-nextest`, etc.) to `soldr cargo ` — follow-up

Why now

soldr v0.7.0 shipped (https://github.com/zackees/soldr/releases/tag/v0.7.0) with the full Rust toolchain passthrough surface:

  • `soldr rustc`, `soldr rustfmt`, `soldr clippy-driver`, `soldr rustdoc`, `soldr rust-gdb`, `soldr rust-lldb`, `soldr rust-analyzer` — all resolve via `rustup which`
  • `soldr cargo ` — cargo front door, honours `rust-toolchain.toml`, forces MSVC on Windows native builds without flagging
  • `--no-cache` top-level flag disables soldr's compilation-cache wrapper for parity with a bare cargo invocation

Acceptance criteria

  • `uv run cargo check --workspace` still succeeds with the same result as before
  • `uv run cargo clippy --workspace` unchanged
  • `uv run rustfmt --check` unchanged
  • `./_cargo`, `./_rustc`, `./_rustfmt` still work from bash
  • `ci/hooks/test_tool_guard.py` passes with new allowed prefixes
  • `run_fbuild`, `run_fbuild_daemon` console scripts still launch the CLIs
  • All existing GitHub Actions builds green on the PR

Risk / rollback

Minimal. soldr's rustup resolver mirrors what fbuild's trampolines already do. If anything goes sideways on the PR, revert is a single-commit rollback; fbuild's existing trampoline logic stays intact in the reverted commit history.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions