Joe Lu
Joe Lu

Reputation: 581

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

I encountered a problem when running 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

I found this issue on GitHub, but it didn't solve my problem.

This is my project Cargo.toml:

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

And my rustc and cargo version:

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

And here is the file Cargo complains about(/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 <[email protected]>" ]

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"

Upvotes: 4

Views: 3495

Answers (1)

Shepmaster
Shepmaster

Reputation: 430554

As listed in the url crate's GitHub issue, it previously used a form of TOML that was actually invalid. Newer versions of Cargo no longer parse that invalid form.

Nothing in your shown dependency list requires url version 0.5.7. url version 0.5.10 has been released, so perform a cargo update to switch to it. Note that 0.5.10 was published on Aug 21, 2016, so it's almost a year old at this point.

Upvotes: 2

Related Questions