Pin Rust toolchain to match CI (1.93)#399
Merged
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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.tomlto pinchannel = "1.93"withclippyandrustfmton a minimal profile. - Update
.github/copilot-instructions.mdto 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
asklar
approved these changes
May 22, 2026
This was referenced May 26, 2026
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
src/rust-toolchain.tomlpinning the local Rust toolchain to the same channel CI uses (ms-prod-1.93in.azure-pipelines/templates/Rust.Build.Job.ymlandMac.Build.Job.yml, equivalent to public1.93).Why
Without this pin, developers on a newer rustup toolchain can pass local
cargo clippy --all-targets --all-features --release -- -D warningsand still hit failures in CI on lints that were introduced, downgraded, removed, or differently-defaulted between Rust releases. For example,clippy::duplicated_attributesis 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.tomlpinschannel = "1.93"withcomponents = ["clippy", "rustfmt"]andprofile = "minimal". Anycargoinvocation fromsrc/(or below) auto-selects this channel on first use.src/next to the workspaceCargo.toml, which is what every cargo command inbuild.bat/build.sh/build-mac.shalreadycds into."1.93"channel (not"1.93.0") lets rustup track patch releases within 1.93, matching howms-prod-1.93tracks Microsoft's internal patches.cargo +<channel> ...orRUSTUP_TOOLCHAIN=<channel> ...for one-off testing on a different toolchain.version: 'ms-prod-1.<N>'lines in the two.azure-pipelines/templates/*.Build.Job.ymlfiles pluschannelhere in the same commit.Validation
cargo --versionfromsrc/: 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 warningsclean under the pinned toolchain. This is the exact CI invocation from.azure-pipelines/templates/Rust.Build.Job.yml(line ~119).Notes
version: 'ms-prod-1.93'parameter still controls what CI itself installs —rust-toolchain.tomldoes 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.