19 lines
850 B
Plaintext
19 lines
850 B
Plaintext
Rust Crates换源
|
|
|
|
------------------------------------------------------------
|
|
mkdir -pv ~/.cargo
|
|
cat > ~/.cargo/config << "EOF"
|
|
[source.crates-io]
|
|
replace-with = "ustc"
|
|
[source.ustc]
|
|
registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"
|
|
EOF
|
|
------------------------------------------------------------
|
|
|
|
编译Rust时需要获取上一个版本的Rust来进行构建, 可以预先在指定位置下载好二进制Rust安装包以提升速度。
|
|
以Rust 1.76.0为例, 下载
|
|
1. https://static.rust-lang.org/dist/cargo-1.75.0-x86_64-unknown-linux-gnu.tar.xz
|
|
2. https://static.rust-lang.org/dist/rust-std-1.75.0-x86_64-unknown-linux-gnu.tar.xz
|
|
2. https://static.rust-lang.org/dist/rustc-1.75.0-x86_64-unknown-linux-gnu.tar.xz
|
|
并将它们放置于build/cache/2023-12-28目录中(发行日期见https://github.com/rust-lang/rust/releases)。
|