Rust Crates 使用国内镜像

我在使用 Rust 安装 rls 时,出现了下载报错,具体如下

info: caused by: error during download
info: caused by: [56] Failure when receiving data from the peer

一看到 from the peer ,我就明白了,大概率被墙了。所以,就要切换为国内镜像源。

目前只有 USTC 提供了 Rust Crates 的镜像源,接下来,我们就开始配置 Rust Crates 源。

https://servers.ustclug.org/2016/01/mirrors-add-rust-crates/
USTC Lug 的公告

配置 Mirror

使用 VSCode 打开配置文件 $HOME/.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"

然后重新在命令行中执行安装代码,可以看到非常高效的完成了安装.

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注