ビルドツールのバージョンの切替について。
ナイトリーへの変更方法を例に紹介している。
以下のコマンドを実行。
> rustup install nightly
方法は幾つかあるが、ここではよく使うもののみを紹介する。
他の方法や優先順位については、後述の『補足: 仕様詳細』を参照。
プロジェクトのルートディレクトリに rust-toolchain.toml
を配置。
IDE と連携させる場合、この方法が必須になる。
[toolchain]
channel = "nightly"
以下のコマンドを実行。
> rustup default nightly
rustup show
コマンドでバージョンの確認ができる。
以下では、stable
と nightly
がインストールされており、選択されているのは後者で、またそれが rust-toolchain.toml
ファイルの影響である事が分かる。
> rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\nossi\.rustup
installed toolchains
--------------------
stable-x86_64-pc-windows-msvc (default)
nightly-x86_64-pc-windows-msvc
active toolchain
----------------
nightly-x86_64-pc-windows-msvc (overridden by 'D:\development\rust_test\rust-toolchain.toml')
rustc 1.81.0-nightly (5affbb171 2024-07-18)
以下は rustup
の公式の説明。