From ec40a4062f2ca09ba930c9ca078d0b79999a78cd Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Sun, 5 Jul 2026 19:32:38 +0000 Subject: [PATCH] build: pin the exact Rust toolchain (1.96.0) to stop rustfmt drift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rust-toolchain.toml pinned the floating "stable" channel, so the CI image baked whatever stable existed at image-build time. When the image is rebuilt onto a newer stable, rustfmt's rules shift and `cargo fmt --all --check` fails on files nobody touched — the recurring format-drift that keeps red-lighting CI. Pin channel = "1.96.0" (== today's stable: rustc ac68faa20, rustfmt 1.9.0-stable), the exact build CI already runs, so this is a no-op now but locks formatting for good: local dev, the Linux CI image, and the Windows runner all use rustup and honor this file, so they converge on one rustfmt. Formatting now only changes in a deliberate bump-this-pin- and-reformat commit. ci.yml cache comment updated to match. Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitea/workflows/ci.yml | 4 ++-- rust-toolchain.toml | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 0f4d451..c24bc72 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -28,8 +28,8 @@ jobs: # Best-effort caches (act_runner's built-in cache server). Keyed on Cargo.lock: # registry/git are download caches, target/ the incremental build. The target key - # carries the rustc version — rust-toolchain.toml pins the floating "stable" - # channel, so the file alone wouldn't invalidate stale incremental state. + # carries the rustc version — resolved via `rustc --version` (below) rather than parsed + # from rust-toolchain.toml, so a pin bump there invalidates stale incremental state too. - name: Cache keys run: echo "rustc=$(rustc --version | cut -d' ' -f2)" >> "$GITHUB_ENV" - uses: actions/cache@v4 diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 73cb934..72d7ad4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,9 @@ +# Pin an EXACT version, not the floating "stable" channel. The CI image bakes whatever +# `stable` was at image-build time; when the image is rebuilt onto a newer stable, rustfmt's +# formatting rules shift and `cargo fmt --all --check` starts failing on files nobody touched +# (format drift). An exact pin makes rustfmt/rustc identical for every contributor and CI, so +# formatting only ever changes in a deliberate bump-this-line-and-reformat commit. +# The CI image (ci/rust-ci.Dockerfile) and the Windows runner both use rustup, which honors this. [toolchain] -channel = "stable" +channel = "1.96.0" components = ["rustfmt", "clippy"]