~/.cargo 目錄下創建config 的文本文件
內容為
[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"
再添加環境變量
sudo nano ~/.bash_profile
內容為
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
如果安裝過程中出現各種安裝問題 請刪除 以上設置
步驟如下:
1. 打開Powershell(注意不是cmd)
2. 輸入以下文本
3 $ENV:HTTPS_PROXY=$proxy
proxy為代理地址
---------------------
如果你使用 Linux 或 macOS,打開終端並輸入如下命令:
$ curl https://sh.rustup.rs -sSf | sh
更新rustup
rustup self update
更新rust編譯器最新的nightly版本
rust update nightly
安裝RLS 標准化 編譯器增強工具
rustup component add rls --toolchain nightly
rustup component add rust-analysis --toolchain nightly
rustup component add rust-src --toolchain nightly
(Optional) Set RUST_SRC_PATH
environment variable to point to the 'src' dir in the Rust source installation e.g.
% export RUST_SRC_PATH=/usr/local/src/rust/src
or
% export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"
It's recommended to set RUST_SRC_PATH
for speed up, but racer detects it automatically if you don't set it.