Rust Development Environment Guide
XWOS RUST Build Tool Installation Guide
2 minute read
Rust Development Tools
- Install RUST according to the official guide;
- Switch mirror sources:
- Ubuntu configuration file path:
~/.cargo/config.toml - Windows configuration file path:
C:\Users\username\.cargo\config.toml
- Ubuntu configuration file path:
[source.crates-io]
replace-with = 'ustc'
[source.ustc]
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"
[registries.ustc]
index = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"
[source.tuna]
registry = "sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"
[registries.tuna]
index = "sparse+https://mirrors.tuna.tsinghua.edu.cn/crates.io-index/"
[source.sjtu]
registry = "sparse+https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/"
[registries.sjtu]
index = "sparse+https://mirrors.sjtug.sjtu.edu.cn/crates.io-index/"
[net]
git-fetch-with-cli = true
- Ubuntu: Install unstable version
rustup install nightly
rustup +nightly target add thumbv8m.main-none-eabihf
rustup +nightly target add thumbv8m.main-none-eabi
rustup +nightly target add thumbv8m.base-none-eabi
rustup +nightly target add thumbv7m-none-eabi
rustup +nightly target add thumbv7em-none-eabihf
rustup +nightly target add thumbv7em-none-eabi
rustup +nightly target add thumbv6m-none-eabi
rustup +nightly target add riscv32imac-unknown-none-elf
rustup +nightly target add aarch64-unknown-none
rustup +nightly component add rust-src
- Windows: Install unstable version
Note: Windows only supports using the gnu version of the toolchain
rustup install nightly-x86_64-pc-windows-gnu
rustup +nightly-x86_64-pc-windows-gnu target add thumbv8m.main-none-eabihf
rustup +nightly-x86_64-pc-windows-gnu target add thumbv8m.main-none-eabi
rustup +nightly-x86_64-pc-windows-gnu target add thumbv8m.base-none-eabi
rustup +nightly-x86_64-pc-windows-gnu target add thumbv7m-none-eabi
rustup +nightly-x86_64-pc-windows-gnu target add thumbv7em-none-eabihf
rustup +nightly-x86_64-pc-windows-gnu target add thumbv7em-none-eabi
rustup +nightly-x86_64-pc-windows-gnu target add thumbv6m-none-eabi
rustup +nightly-x86_64-pc-windows-gnu target add riscv32imac-unknown-none-elf
rustup +nightly-x86_64-pc-windows-gnu target add aarch64-unknown-none
rustup +nightly-x86_64-pc-windows-gnu component add rust-src
Installing LSP
LSP (Language Server Protocol) is a new generation tool for browsing source code.
For Rust, rust-analyzer is the recommended LSP.
There are two installation methods:
- Install via command to get the stable version:
rustup +nightly component add rust-analyzer
rustup +nightly component add rust-src
- Install from source to get the latest version:
git clone https://github.com/rust-analyzer/rust-analyzer.git
cd rust-analyzer
cargo xtask install