货物构建导致"不匹配id"

时间:2016-12-12 02:49:46

标签: rust rust-cargo

我今天无法用货物建造,因为没有匹配的ID"错误。

这里发生了什么?

$ 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)

2 个答案:

答案 0 :(得分:4)

我不确定导致问题的原因 - 但可以证明这不是网络问题。删除~/.cargo/registry修复了问题。

$ 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

答案 1 :(得分:1)

我遇到了同样的问题。

def main(): pass if __name__ == '__main__': main()

清除它。