我在运行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"
我的rustc
和cargo
版本:
➜ ~ 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"
答案 0 :(得分:2)
如url crate's GitHub issue中所列,它之前使用的是一种实际上无效的TOML形式。较新版本的Cargo不再解析该无效表单。
您显示的依赖项列表中没有任何内容需要url版本0.5.7。 url版本0.5.10已发布,因此执行cargo update
切换到它。请注意,0.5.10于2016年8月21日发布,所以现在已经差不多一年了。