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"]