Skip to content

Commit 49f1fa5

Browse files
committed
Unconditionally install rustfmt
Rustfmt used to be optional for nightlies long ago, but it is now always present. Also rename rust-toolchain to rust-toolchain.toml.
1 parent b73270f commit 49f1fa5

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Avoid installing rustc-dev
3030
run: |
31-
sed -i 's/components.*/components = ["rustfmt"]/' rust-toolchain
31+
sed -i 's/components.*/components = ["rustfmt"]/' rust-toolchain.toml
3232
rustfmt -v
3333
3434
- name: Rustfmt
@@ -88,7 +88,7 @@ jobs:
8888
uses: actions/cache@v4
8989
with:
9090
path: build/cg_clif
91-
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
91+
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}
9292

9393
- name: Set MinGW as the default toolchain
9494
if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'
@@ -158,7 +158,7 @@ jobs:
158158
uses: actions/cache@v4
159159
with:
160160
path: build/cg_clif
161-
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
161+
key: ${{ runner.os }}-x86_64-unknown-linux-gnu-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}
162162

163163
- name: Install hyperfine
164164
run: |
@@ -207,7 +207,7 @@ jobs:
207207
uses: actions/cache@v4
208208
with:
209209
path: build/cg_clif
210-
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-dist-cargo-build-target-${{ hashFiles('rust-toolchain', '**/Cargo.lock') }}
210+
key: ${{ runner.os }}-${{ matrix.env.TARGET_TRIPLE }}-dist-cargo-build-target-${{ hashFiles('rust-toolchain.toml', '**/Cargo.lock') }}
211211

212212
- name: Set MinGW as the default toolchain
213213
if: matrix.os == 'windows-latest' && matrix.env.TARGET_TRIPLE == 'x86_64-pc-windows-gnu'

.github/workflows/rustc.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
uses: actions/cache@v4
2121
with:
2222
path: build/cg_clif
23-
key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain', 'Cargo.lock') }}
23+
key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
2424

2525
- name: Test
2626
run: ./scripts/test_bootstrap.sh
@@ -40,7 +40,7 @@ jobs:
4040
uses: actions/cache@v4
4141
with:
4242
path: build/cg_clif
43-
key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain', 'Cargo.lock') }}
43+
key: ${{ runner.os }}-rustc-test-cargo-build-target-${{ hashFiles('rust-toolchain.toml', 'Cargo.lock') }}
4444

4545
- name: Install ripgrep
4646
run: |

rust-toolchain

Lines changed: 0 additions & 4 deletions
This file was deleted.

rust-toolchain.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[toolchain]
2+
channel = "nightly-2025-12-16"
3+
components = ["rust-src", "rustc-dev", "llvm-tools", "rustfmt"]
4+
profile = "minimal"

scripts/rustup.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ case $1 in
2222
"prepare")
2323
echo "=> Installing new nightly"
2424
rustup toolchain install --profile minimal "nightly-${TOOLCHAIN}" # Sanity check to see if the nightly exists
25-
sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain
26-
rustup component add rustfmt || true
25+
sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain.toml
2726

2827
echo "=> Uninstalling all old nightlies"
2928
for nightly in $(rustup toolchain list | grep nightly | grep -v "$TOOLCHAIN" | grep -v nightly-x86_64); do
@@ -35,7 +34,7 @@ case $1 in
3534
./y.sh prepare
3635
;;
3736
"commit")
38-
git add rust-toolchain
37+
git add rust-toolchain.toml
3938
git commit -m "Rustup to $(rustc -V)"
4039
;;
4140
"push")

0 commit comments

Comments
 (0)