Skip to content

Commit 9b5d9ba

Browse files
fix(scripts): set RUSTUP_TOOLCHAIN early as process env var
Set RUSTUP_TOOLCHAIN at the start of Install-RustToolchain so all subsequent cargo/rustc calls use the correct nightly. Removes reliance on rustup default which can be overridden by system-level config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9b3d78f commit 9b5d9ba

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

scripts/build.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@ function Install-RustToolchain {
148148
Write-Step "Setting up Rust toolchain ($script:RustToolchain)"
149149
Assert-Command 'rustup'
150150

151+
# Set RUSTUP_TOOLCHAIN for the entire process so all cargo/rustc
152+
# invocations use the correct nightly, regardless of rustup default
153+
$env:RUSTUP_TOOLCHAIN = $script:RustToolchain
154+
151155
rustup toolchain install $script:RustToolchain
152-
rustup default $script:RustToolchain
153-
rustup target add x86_64-pc-windows-msvc --toolchain $script:RustToolchain
156+
rustup target add $script:Target --toolchain $script:RustToolchain
154157
Write-Host " rustc: $(rustc --version)"
155158
Write-Host " cargo: $(cargo --version)"
156159
}
@@ -233,8 +236,6 @@ function Build-NsisInstaller {
233236
Assert-Command 'npx'
234237
Import-EnvFile
235238

236-
$env:RUSTUP_TOOLCHAIN = $script:RustToolchain
237-
238239
# Build a config override that skips beforeBuildCommand (frontend
239240
# is already built by Build-Frontend) and optionally includes signing.
240241
$overrideCfg = @{ build = @{ beforeBuildCommand = '' } }

0 commit comments

Comments
 (0)