From b5574f42dbfdfb78462e2de6a4e77639aa1deff0 Mon Sep 17 00:00:00 2001 From: Isaac Doidge Date: Fri, 21 Aug 2026 14:37:55 +1000 Subject: [PATCH] Pin the toolchain this fork builds with (smr-moonshot#3675) Nothing in the repository declared a compiler, so the one used was whatever the machine happened to provide, and the set of toolchains that actually build the fork is both narrow and undeclared: the workspace `rust-version` of 1.88.0 is not sufficient in practice, while the local rustup default of 1.87.0 is rejected outright. A contributor therefore meets errors that read as code defects rather than environment ones, and a future move of `stable` can break the fork with no change on our side and nothing to pin back to. Pin 1.97.1, the version `smr-moonshot` pins, so the fork compiles under the toolchain its consumer uses. The pin covers the components and the cross-compilation target the workflows ask for, since rustup installs those from the file. Two jobs deliberately need a different compiler: the test matrix, which sweeps the MSRV, stable and nightly, and the book, whose rustdoc invocation passes `-Zunstable-options`. Both now set `RUSTUP_TOOLCHAIN`, which rustup ranks above `rust-toolchain.toml`; without that the pin would silently collapse the matrix onto one compiler and break the book build. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/book.yml | 4 ++++ .github/workflows/ci.yml | 5 +++++ rust-toolchain.toml | 14 ++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 rust-toolchain.toml diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index 919f41802f..67d111f5f1 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -64,6 +64,10 @@ jobs: - name: Install toolchain uses: dtolnay/rust-toolchain@nightly + # `Build docs` below passes `-Zunstable-options`, so this job needs nightly rather than the + # toolchain `rust-toolchain.toml` pins. + - name: Use nightly for this job + run: echo "RUSTUP_TOOLCHAIN=nightly" >> "$GITHUB_ENV" - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd65e75198..180b87d1fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,6 +23,11 @@ jobs: matrix: rust: ["1.88", "stable", "nightly"] flags: ["--no-default-features", "", "--all-features"] + # This matrix is the one place that deliberately compiles on something other than the pinned + # toolchain, so it has to outrank `rust-toolchain.toml`. `RUSTUP_TOOLCHAIN` does; the toolchain + # the install step selects does not. + env: + RUSTUP_TOOLCHAIN: ${{ matrix.rust }} steps: - uses: actions/checkout@v5 - uses: dtolnay/rust-toolchain@master diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000000..c8fb1836dc --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,14 @@ +# The Rust version this fork builds and tests with. It matches the pin in `smr-moonshot`, the +# consumer of these crates, rather than the workspace `rust-version` (1.88.0) that upstream `revm` +# declares as its MSRV: this fork only ever has to compile under Supra's toolchain, and the range of +# compilers that actually build it is narrower than the MSRV suggests. +# +# This file is the only functional pin: rustup prefers it over `rustup default`, so it also decides +# the toolchain in CI, whatever channel a toolchain-install step there names. The jobs that +# genuinely need a different compiler — the MSRV/nightly test matrix, and the book's nightly +# rustdoc — override it with `RUSTUP_TOOLCHAIN`, which rustup ranks above this file. +[toolchain] +channel = "1.97.1" +components = ["clippy", "rust-docs", "rustfmt"] +# `check-no-std` cross-compiles to this target. +targets = ["riscv32imac-unknown-none-elf"]