Skip to content

Pin Rust toolchain to match CI (1.93)#399

Merged
MGudgin merged 1 commit into
mainfrom
user/gudge/pin-rust-toolchain
May 23, 2026
Merged

Pin Rust toolchain to match CI (1.93)#399
MGudgin merged 1 commit into
mainfrom
user/gudge/pin-rust-toolchain

Conversation

@MGudgin

@MGudgin MGudgin commented May 22, 2026

Copy link
Copy Markdown
Member

Summary

Add src/rust-toolchain.toml pinning the local Rust toolchain to the same channel CI uses (ms-prod-1.93 in .azure-pipelines/templates/Rust.Build.Job.yml and Mac.Build.Job.yml, equivalent to public 1.93).

Why

Without this pin, developers on a newer rustup toolchain can pass local cargo clippy --all-targets --all-features --release -- -D warnings and still hit failures in CI on lints that were introduced, downgraded, removed, or differently-defaulted between Rust releases. For example, clippy::duplicated_attributes is denied in clippy 1.93 but allow-by-default (or absent) in 1.94 — phase 3.5 (#389) hit this on CI despite running clean locally on 1.94. The pin eliminates that whole class of skew.

What it does

  • src/rust-toolchain.toml pins channel = "1.93" with components = ["clippy", "rustfmt"] and profile = "minimal". Any cargo invocation from src/ (or below) auto-selects this channel on first use.
  • The file is placed in src/ next to the workspace Cargo.toml, which is what every cargo command in build.bat/build.sh/build-mac.sh already cds into.
  • Pinning to the "1.93" channel (not "1.93.0") lets rustup track patch releases within 1.93, matching how ms-prod-1.93 tracks Microsoft's internal patches.
  • Local opt-out: cargo +<channel> ... or RUSTUP_TOOLCHAIN=<channel> ... for one-off testing on a different toolchain.
  • Bump procedure documented inline in the file: bump the matching version: 'ms-prod-1.<N>' lines in the two .azure-pipelines/templates/*.Build.Job.yml files plus channel here in the same commit.

Validation

  • Deleted my local 1.93.0 cache, then ran cargo --version from src/: rustup auto-synced the channel and installed Rust 1.93.1 (latest patch).
  • cargo clippy --target x86_64-pc-windows-msvc --workspace --all-targets --all-features --profile release --locked -- -D warnings clean under the pinned toolchain. This is the exact CI invocation from .azure-pipelines/templates/Rust.Build.Job.yml (line ~119).

Notes

  • The 1ES pipeline's version: 'ms-prod-1.93' parameter still controls what CI itself installs — rust-toolchain.toml does not override that. The two settings serve as parallel pins on each side. Keeping them in sync is a small lift; the bump procedure documented in the file's header comment lists the exact files to touch.
  • Doesn't change any build commands or test commands — just stabilizes the toolchain underneath them.

Add `src/rust-toolchain.toml` pinning the local Rust toolchain to the
same channel CI uses (`ms-prod-1.93` in
`.azure-pipelines/templates/*.Build.Job.yml`, equivalent to public
`1.93`). Without this pin, developers on a newer rustup toolchain
pass local `cargo clippy --all-targets --all-features --release --
-D warnings` and still hit CI failures on lints that were introduced,
downgraded, or differently-defaulted between releases — for example
`clippy::duplicated_attributes` (added in 1.93, weakened in 1.94)
recently bit phase 3.5 (#389) on CI despite running clean locally on
1.94.

The pin is honored automatically by rustup: any `cargo` command from
`src/` (or below) downloads the channel on first use and selects it
thereafter. Opt-out with `cargo +<channel> ...` or
`RUSTUP_TOOLCHAIN=<channel>` for one-off testing.

Also document the pin and the bump procedure in
`.github/copilot-instructions.md` § Prerequisites.

Testing
-------

- `cargo --version` from `src/` reports 1.93.1 after rustup auto-
  syncs the channel on first invocation.
- `cargo clippy --target x86_64-pc-windows-msvc --workspace
  --all-targets --all-features --profile release --locked --
  -D warnings` clean under 1.93 (this is the exact CI invocation
  from `.azure-pipelines/templates/Rust.Build.Job.yml`).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 22, 2026 23:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Pins the Rust toolchain used for local development to align with the Rust version installed in CI (ms-prod-1.93), reducing “works locally but fails in CI” drift (especially for clippy lint sets) in the Rust workspace under src/.

Changes:

  • Add src/rust-toolchain.toml to pin channel = "1.93" with clippy and rustfmt on a minimal profile.
  • Update .github/copilot-instructions.md to document the pin behavior, opt-out, and the coordinated bump procedure with CI templates.
Show a summary per file
File Description
src/rust-toolchain.toml Introduces a local-dev Rust toolchain pin to 1.93 (with clippy/rustfmt) to match CI’s toolchain versioning intent.
.github/copilot-instructions.md Documents the toolchain pin location/behavior and the required sync steps when bumping CI + local pins.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@MGudgin MGudgin merged commit ad25958 into main May 23, 2026
19 checks passed
@MGudgin MGudgin deleted the user/gudge/pin-rust-toolchain branch May 23, 2026 00:00
MGudgin pushed a commit that referenced this pull request May 26, 2026
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.
MGudgin pushed a commit that referenced this pull request May 26, 2026
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.
MGudgin added a commit that referenced this pull request May 26, 2026
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.

Co-authored-by: Gudge <gudge@microsoft.com>
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.

3 participants