Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TOML parsing isn't very helpful. #2972

Closed
RandomInsano opened this issue Aug 7, 2016 · 2 comments
Closed

TOML parsing isn't very helpful. #2972

RandomInsano opened this issue Aug 7, 2016 · 2 comments

Comments

@RandomInsano
Copy link
Contributor

RandomInsano commented Aug 7, 2016

I've updated to nightly (tried both August 5th and 6th) on Ubuntu 16.04. When a dependent package's TOML file isn't valid, Cargo throws an error. That's good, but it would be very helpful if the TOML parser could pass back what the heck the line was that parsing failed on.

Some of this helpfulness likely needs to be implemented in the toml package, and some needs to be implemented here. How can I help get that done?

Here's the exampley details:

My project requires a package that requires the package Iron, specifically version 0.3. It seems to fail to build where it hadn't before:

root@c629e2ba5866:/home/sail/sail-rust# cargo build --release --verbose
error: unable to get packages from source

Caused by:
  failed to parse manifest at `/root/.cargo/registry/src/github.jparrowsec.cn-1ecc6299db9ec823/iron-0.3.0/Cargo.toml`

Caused by:
  you have already provided an operation, such as =, ~, or ^; only use one

That isn't terribly true or at all helpful. Here be the steps to reproduce the problem for playing around:

root@c629e2ba5866:/tmp# cargo new hello_world && cd hello_world
     Created library `hello_world` project
root@c629e2ba5866:/tmp/hello_world# echo "iron = \"0.3\"" >> Cargo.toml 
root@c629e2ba5866:/tmp/hello_world# cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
error: unable to get packages from source

Caused by:
  failed to parse manifest at `/root/.cargo/registry/src/github.jparrowsec.cn-1ecc6299db9ec823/iron-0.3.0/Cargo.toml`

To learn more, run the command again with --verbose.

Now, nothing in here really looked wrong to me at first glance, especially based on that error:

[package]
name = "iron"
version = "0.3.0"
description = "Extensible, Concurrency Focused Web Development in Rust."
readme = "README.md"
repository = "https://github.com/iron/iron"
documentation = "http://ironframework.io/doc/iron/"
license = "MIT"

[lib]

name = "iron"
path = "src/lib.rs"

[features]
ssl = ["hyper/ssl"]

[dependencies]
typemap = "0.3"
url = "0.5"
plugin = "0.2*"
modifier = "0.1"
error = "0.1"
log = "0.3"
conduit_mime_types = "0.7"
lazy_static = "0.1"
num_cpus = "0.2"

[dependencies.hyper]
version = "0.8"
default-features = false

[dev-dependencies]
time = "*"

It turned out to be the line plugin = "0.2*" which is definitely malformed but was functional before. I really want the error to at least point you to which line was parsed when it failed (even if the config data spans multiple lines).

@steveklabnik
Copy link
Member

This feels like a duplicate of #2964

@RandomInsano
Copy link
Contributor Author

Wow! Yeah, that's eerily close! I'll close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants