Cargo 无法为 url 版本 0.5.7 解析 Cargo.toml

Cargo can't parse the Cargo.toml for url version 0.5.7

我在 运行 cargo build:

时遇到问题
/usr/local/bin/cargo build --color=always
error: unable to get packages from source

Caused by:
failed to parse manifest at `/home/lzc/.multirust/toolchains/stable/cargo/registry/src/github.com-1ecc6299db9ec823/url-0.5.7/Cargo.toml`

Caused by:
could not parse input as TOML

Caused by:
expected newline, found an identifier at line 14

我在 GitHub 上找到了这个 issue,但它没有解决我的问题。

这是我的项目Cargo.toml:

[dependencies]
hyper = "0.7.2"
rustc-serialize = "0.3"
websocket = "0.15.1"

还有我的 rustccargo 版本:

➜  ~ cargo -V
cargo 0.18.0 (fe7b0cdcf 2017-04-24)
➜  ~ rustc -V
rustc 1.17.0 (56124baa9 2017-04-24)

这是 Cargo 抱怨的文件 (/home/lzc/.multirust/toolchains/stable/cargo/registry/src/github.com-1ecc6299db9ec823/url-0.5.7/Cargo.toml):

[package]

name = "url"
version = "0.5.7"
authors = [ "Simon Sapin <simon.sapin@exyr.org>" ]

description = "URL library for Rust, based on the WHATWG URL Standard"
documentation = "http://servo.github.io/rust-url/url/index.html"
repository = "https://github.com/servo/rust-url"
readme = "README.md"
keywords = ["url", "parser"]
license = "MIT/Apache-2.0"

[[test]] name = "format"                #<- line 14
[[test]] name = "form_urlencoded"
[[test]] name = "idna"
[[test]] name = "punycode"
[[test]] name = "tests"
[[test]]
name = "wpt"
harness = false

[dev-dependencies]
rustc-test = "0.1"

[features]
query_encoding = ["encoding"]
serde_serialization = ["serde"]
heap_size = ["heapsize", "heapsize_plugin"]

[dependencies.heapsize]
version = ">=0.1.1, <0.4"
optional = true

[dependencies.heapsize_plugin]
version = "0.1.0"
optional = true

[dependencies.encoding]
version = "0.2"
optional = true

[dependencies.serde]
version = ">=0.6.1, <0.8"
optional = true

[dependencies]
uuid = "0.1.17"
rustc-serialize = "0.3"
unicode-bidi = "0.2.3"
unicode-normalization = "0.1.2"
matches = "0.1"

url crate's GitHub issue中所列,它以前使用了一种实际上无效的TOML形式。较新版本的 Cargo 不再解析该无效形式。

显示的依赖项列表中没有任何内容需要 url 版本 0.5.7。 url 版本 0.5.10 已经发布,所以执行 cargo update 切换到它。请注意,0.5.10 发布于 2016 年 8 月 21 日,所以此时已经快一年了。