Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cargo build results in "No match for id"

I'm unable to build with cargo today due to a "no match for id" error.

What's going on here?

$ rustup default stable
info: using existing install for 'stable-x86_64-apple-darwin'
info: default toolchain set to 'stable-x86_64-apple-darwin'

  stable-x86_64-apple-darwin unchanged - rustc 1.13.0 (2c6933acc 2016-11-07)

$ git clone https://github.com/serde-rs/json
Cloning into 'json'...
remote: Counting objects: 1755, done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 1755 (delta 7), reused 0 (delta 0), pack-reused 1729
Receiving objects: 100% (1755/1755), 401.86 KiB | 431.00 KiB/s, done.
Resolving deltas: 100% (717/717), done.
Checking connectivity... done.

$ cd json/json
$ cargo build --verbose
    Updating registry `https://github.com/rust-lang/crates.io-index`
error: failed to load source for a dependency on `clippy`

Caused by:
  Unable to update registry https://github.com/rust-lang/crates.io-index

Caused by:
  failed to fetch `https://github.com/rust-lang/crates.io-index`

Caused by:
  [9/-3] Object not found - no match for id (aaceb5b4ca9ce0a6e5a02f86cea5635f721d29d8)
like image 756
Synesso Avatar asked Dec 12 '16 02:12

Synesso


Video Answer


2 Answers

I'm not sure what caused the problem - but can attest that it was not a network issue. Removing ~/.cargo/registry fixed the issue.

$ mv ~/.cargo/registry/ ~/.cargo/registry_
$ cargo build --verbose
    Updating registry `https://github.com/rust-lang/crates.io-index`
 Downloading num-traits v0.1.36
 Downloading serde v0.8.19
 Downloading dtoa v0.2.2
 Downloading itoa v0.1.1
   Compiling itoa v0.1.1
   Compiling dtoa v0.2.2
   Compiling num-traits v0.1.36
   Compiling serde v0.8.19
     Running `rustc /Users/jem/.cargo/registry/src/github.com-1ecc6299db9ec823/itoa-0.1.1/src/lib.rs --crate-name itoa --crate-type lib -g -C metadata=58ab3e11c7b36cd3 -C extra-filename=-58ab3e11c7b36cd3 --out-dir /Users/jem/t/json/json/target/debug/deps --emit=dep-info,link -L dependency=/Users/jem/t/json/json/target/debug/deps --cap-lints allow`
     Running `rustc /Users/jem/.cargo/registry/src/github.com-1ecc6299db9ec823/dtoa-0.2.2/src/lib.rs --crate-name dtoa --crate-type lib -g -C metadata=76ebb504ac31c05f -C extra-filename=-76ebb504ac31c05f --out-dir /Users/jem/t/json/json/target/debug/deps --emit=dep-info,link -L dependency=/Users/jem/t/json/json/target/debug/deps --cap-lints allow`
     Running `rustc /Users/jem/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.1.36/src/lib.rs --crate-name num_traits --crate-type lib -g -C metadata=92bb90166cd1857c -C extra-filename=-92bb90166cd1857c --out-dir /Users/jem/t/json/json/target/debug/deps --emit=dep-info,link -L dependency=/Users/jem/t/json/json/target/debug/deps --cap-lints allow`
     Running `rustc /Users/jem/.cargo/registry/src/github.com-1ecc6299db9ec823/serde-0.8.19/src/lib.rs --crate-name serde --crate-type lib -g --cfg feature=\"default\" --cfg feature=\"std\" -C metadata=97f01bf227222121 -C extra-filename=-97f01bf227222121 --out-dir /Users/jem/t/json/json/target/debug/deps --emit=dep-info,link -L dependency=/Users/jem/t/json/json/target/debug/deps --cap-lints allow`
   Compiling serde_json v0.8.4 (file:///Users/jem/t/json/json)
     Running `rustc src/lib.rs --crate-name serde_json --crate-type lib -g -C metadata=924ef2e3fa7e5748 --out-dir /Users/jem/t/json/json/target/debug/deps --emit=dep-info,link -L dependency=/Users/jem/t/json/json/target/debug/deps --extern num_traits=/Users/jem/t/json/json/target/debug/deps/libnum_traits-92bb90166cd1857c.rlib --extern serde=/Users/jem/t/json/json/target/debug/deps/libserde-97f01bf227222121.rlib --extern dtoa=/Users/jem/t/json/json/target/debug/deps/libdtoa-76ebb504ac31c05f.rlib --extern itoa=/Users/jem/t/json/json/target/debug/deps/libitoa-58ab3e11c7b36cd3.rlib`
    Finished debug [unoptimized + debuginfo] target(s) in 8.44 secs
like image 174
Synesso Avatar answered Nov 12 '22 12:11

Synesso


I have been getting the same issue.

rm -rf ~/.cargo/registry

Clears it up.

like image 20
Charles Schleich Avatar answered Nov 12 '22 14:11

Charles Schleich