Win7 VSCode line installation Rust language and environment configuration

Bedtime completely resolved VSCode, press the F12 not jump to the issue of the standard library source code.

 

First, if installed over the offline version, uninstall.

Then go to the official website to download

rustup-init.exe

https://www.rust-lang.org/tools/install

After just great, do not rush to install

New four environment variables

CARGOHOME
E As of: \ Rust \ Cargo

 

RUSTUP_HOME
E:\Rust\rustup

 

RUSTUP_DIST_SERVER
https://mirrors.ustc.edu.cn/rust-static

 

RUSTUP_UPDATE_ROOT
https://mirrors.ustc.edu.cn/rust-static/rustup

 

The first two you want to customize cargo and rustup directory, the latter two is to switch rustup for domestic source, or can only be linked to the agent.

Double-click to get the rustup-init.exe, according to a default installation, which is installed msvc version.

After a long slow wait time, you should show a successful installation.

 

Next, before, cargo entering custom directory, create a file with no extension config, content in the past, is switching to use domestic sources.

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "https://mirrors.ustc.edu.cn/crates.io-index"

 

Open a command prompt, enter

rustup component add rust-src

If the

info: component 'rust-src' is up to date

Description source has been installed

Now open VSCode

If you had previously disabled rustup in VSCode, and now remove the hook, and then enable

 

Test F12, find a place to write

std::ops::AddAssign

Press F12 to see if I can jump, if not, wait a while and try to be able to jump, and the display can not be found, you can open the path to see if the file exists own hand, similar

E:\Rust\rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore\ops\arith.rs

Then press F12 to return VSCode will jump directly to the source at the.

This sometimes can not find the show seems to be a Bug, but I am here to present correctly to jump to the source.

 

Reference links:

https://blog.csdn.net/m0_37696990/article/details/82812628

https://fungos.github.io/blog/2017/08/12/setting-up-a-rust-environment-on-windows/

 

Guess you like

Origin www.cnblogs.com/kileyi/p/11374829.html