Skip to content

build.bat: install rustup targets for pinned toolchain#415

Closed
MGudgin wants to merge 1 commit into
mainfrom
worktree-fix-buildbat-toolchain
Closed

build.bat: install rustup targets for pinned toolchain#415
MGudgin wants to merge 1 commit into
mainfrom
worktree-fix-buildbat-toolchain

Conversation

@MGudgin

@MGudgin MGudgin commented May 26, 2026

Copy link
Copy Markdown
Member

Summary

  • Mirrors the rustup target add fix from build-mac.sh (lines 87-92) into build.bat so build.bat --all works for developers whose 1.93 install (pinned in Pin Rust toolchain to match CI (1.93) #399) only includes the host target's stdlib.
  • Cross-target builds (aarch64-pc-windows-msvc from x86_64 hosts, or vice versa) were failing because rustup auto-downloads the pinned channel for the host triple only — the cross-target stdlib still needs an explicit rustup target add.
  • Guarded by where rustup; output silenced; errors swallowed so a missing target falls through to a real cargo build diagnostic rather than a vague rustup one.
  • build.sh doesn't need the equivalent — it builds without --target so the host-channel auto-install is sufficient.

Test plan

  • build.bat --all from a clean state with only the native target installed under 1.93 — both x86_64-pc-windows-msvc and aarch64-pc-windows-msvc compile, exit 0.
  • Reviewer to sanity-check on an ARM64 host if available.
  • CI green.
Microsoft Reviewers: Open in CodeFlow

After #399 pinned the local Rust toolchain to 1.93 via
src/rust-toolchain.toml, `build.bat --all` started failing for
developers whose 1.93 install only has the host target's stdlib —
rustup auto-downloads the pinned channel on first cargo invocation
from src/, but only for the host triple, so the cross-target build
(aarch64 from x86_64 hosts, or vice versa) fails with a missing
stdlib.

Mirror the fix already in build-mac.sh (lines 87-92): before
running cargo, gate on `where rustup` and `rustup target add` each
requested triple inside src/ so the pin applies. Output is silenced
and errors swallowed — if rustup itself can't add the target, the
subsequent `cargo build` will produce the real diagnostic.

build.sh on Linux doesn't need this because it builds for the host
target without --target, which rustup's channel auto-install
already covers.

Verified: `build.bat --all` now builds both x86_64-pc-windows-msvc
and aarch64-pc-windows-msvc cleanly on a host with only the native
target previously installed under 1.93.
Copilot AI review requested due to automatic review settings May 26, 2026 19:16
@MGudgin MGudgin closed this May 26, 2026
@MGudgin
MGudgin deleted the worktree-fix-buildbat-toolchain branch May 26, 2026 19:16
@MGudgin
MGudgin removed the request for review from Copilot May 26, 2026 19:38
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