rust - Cargo 无法解析 url 版本 0.5.7 的 Cargo.toml

标签 rust rust-cargo

我在运行 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

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

这是我的项目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 日,所以此时已经快一年了。

关于rust - Cargo 无法解析 url 版本 0.5.7 的 Cargo.toml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45479799/

相关文章:

struct - 访问枚举内的结构

rust - 什么是例子,它们有什么用?

time - 使用 Cargo 获取执行时间

rust - 如何在 Rust 中指定链接器路径?

logging - 运行 cargo test 时如何设置日志级别?

rust - 发送要构造的宏的枚举变量

post - 如何修复 Rocket 中表单 POST 请求的解析错误?

typescript - TypeScript 的 Array.map 解构的 Rust 等价物是什么?

rust - 在Rust教程代码中获取 “error[E0599]: no method named write_fmt found”错误

rust - 如何使 cargo 保存分析?