Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I debug `cargo build` hanging at "Updating crates.io index"?

My Rust project no longer builds after some conflicts between my RLS plugin and terminal build. I searched around the web and found suggestion of removing my ~/.cargo/registry/index/*, but after that I can't even build any project.

Now the build always stops at

Updating crates.io index

Passing in the --verbose option doesn't help so I don't even know whether it's dying. What should I do next? How to debug this issue?

like image 677
Fei Avatar asked Nov 18 '18 12:11

Fei


People also ask

Where are cargo binaries stored?

All binaries installed with cargo install are stored in the installation root's bin folder. If you installed Rust using rustup.rs and don't have any custom configurations, this directory will be $HOME/. cargo/bin. Ensure that directory is in your $PATH to be able to run programs you've installed with cargo install .

Where do you put cargo in TOML?

Cargo. toml and Cargo. lock are stored in the root of your project (package root). Source code goes in the src directory.

What does cargo do in Rust?

Cargo is the Rust package manager. Cargo downloads your Rust package's dependencies, compiles your packages, makes distributable packages, and uploads them to crates.io, the Rust community's package registry.


1 Answers

Change cargo source in ~/.cargo/config. This works for me.

For example:

[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"
like image 94
Tianyi Liu Avatar answered Nov 16 '22 02:11

Tianyi Liu