This paper introduces the installation and configuration of rust development environment under windows.
1 install the tool chain for MSVC abi
stayVs2019 C / C + + tool chainDownload the generation tool from the official website and check itVisual studio build toolDownload and install
be careful:This tool does not install visual studio, but only the tool chain of MSVC.
2. Configure the installation position of rust tool chain
Add the following two environment variables to specify
- CARGO_HOME: specify
cargoInstall directory for.
- RUSTUP_HOME: specify
rustupInstall directory for.
be careful：They are optional. If not specified, they are installed in the home directory by default
rustupChina University of science and technology
Add the following two environment variables to update the tool chain and tool chain with the source of China University of science and technology respectively
cargoChina University of science and technology
cargoCreate a file named
config, where the contents are specified as:
[source.crates-io] registry = "https://github.com/rust-lang/crates.io-index" replace-with = 'ustc' [source.ustc] registry = "git://mirrors.ustc.edu.cn/crates.io-index"
RLSThe full name of is:
Rust Language Server, a daemon, is used for IPC communication with the IDE used during development to complete code prompt, jump to definition, display variable type and other functions.
stdIt’s rust’s standard library. By default, rust installs the binary code of the standard library, and after adding the source code, it is easy for us to query the implementation of some standard libraries.
Install using the following command:
rustup component add rls --toolchain stable # RLS Trust component add trust analysis -- toolchain stable # analysis tool Trust component add trust SRC -- toolchain stable # STD source code
6. Install vscode plug-in
rust-analyzerAnd its dependencies
rust-analyzer serverIt is automatically pulled from GitHub by vscode. If the installation fails due to network reasons, you can manually compile and install from the source code by performing the following operations:
- Install locally
node.jsEnvironment for packaging and generating vscode plug-ins.
rust-analyzer serverSource code.
Unzip and execute the following command in the root directory of the source code:
cargo xtask install
The rust environment is now installed.