rustrust-cargo

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?


Solution

  • 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"