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

Point out _which_ version failed to error #2964

Closed
steveklabnik opened this issue Aug 5, 2016 · 7 comments
Closed

Point out _which_ version failed to error #2964

steveklabnik opened this issue Aug 5, 2016 · 7 comments
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself.

Comments

@steveklabnik
Copy link
Member

Given this Cargo.toml:

[package]
name = "foo"
version = "1.2.3"
authors = []

[dependencies]
plugin = "0.2*"

You get this error:

$ cargo build --verbose
error: failed to parse manifest at `/home/steve/tmp/lol/Cargo.toml`

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

Now, there's two things that aren't great about this error. First, the text isn't as helpful as it could be, but that's just Cargo passing on the messages semver is giving, so that's not Cargo's fault. But what Cargo could do in this instance is say exactly which version failed to parse.

In this case, the actual Cargo.toml was huge, with a ton of dependencies, and it took a sharp eye to notice that it should have been 0.2.*. If it had pointed out which version failed, it would have been a lot easier.

@steveklabnik steveklabnik added the A-diagnostics Area: Error and warning messages generated by Cargo itself. label Aug 5, 2016
@alexcrichton
Copy link
Member

Should be a pretty easy bug too! Just a chain_error needs to be somewhere in the util/toml.rs parsing code most likely

@RandomInsano
Copy link
Contributor

RandomInsano commented Aug 7, 2016

I wonder if it might be with PackageId's constructor. Checked the version decoder for TomlVersion via a naïve println!() and iron's plugin dependency version was never listed.

Currently hacking on this, but running out of time for the day. I don't really understand the chain_error business or if it's applicable when calling from to_package_id

@alexcrichton
Copy link
Member

Hm maybe yeah! Probably good in any case to bolster up error reporting there anyway :)

I think though that this is probably coming from Dependency::parse where the VersionReq is parsed

@kevinmehall
Copy link

Should the increased strictness of the semver parser be considered a breaking change? I have a project with Iron 0.3.0 in Cargo.lock that builds on stable but fails to build on nightly with this error.

For anyone uses Iron 0.3.0 and finds this issue when searching for the error message, the fix is to update Iron to 0.3.1, which fixes the malformed version in its Cargo.toml.

@steveklabnik
Copy link
Member Author

There's already discussion of that in another bug. I'd link but I'm on mobile.

From SemVer's perspective, this is a bugfix, not a breaking change. Regardless, this ticket is valid either way.

On Aug 16, 2016, 18:48 -0400, Kevin Mehall notifications@github.com, wrote:

Should the increased strictness of the semver parser be considered a breaking change? I have a project with Iron 0.3.0 in Cargo.lock that builds on stable but fails to build on nightly with this error.

For anyone uses Iron 0.3.0 and finds this issue when searching for the error message, the fix is to update Iron to 0.3.1 (iron/iron#471), which fixes the malformed version in its Cargo.toml.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub (#2964 (comment)), or mute the thread (https://github.com/notifications/unsubscribe-auth/AABsikVwkjMKKZo6SUeSbnHh7gt5DSDLks5qgj5JgaJpZM4Jd6YR).

@kevinmehall
Copy link

#3001, for the purposes of cross-linking

@ehuss
Copy link
Contributor

ehuss commented Dec 15, 2018

I think this is sufficiently fixed now. The original example shows a large warning added in #3154 with:

warning: parsed version requirement `0.2*` is no longer valid

...plus a long description

Details for parse errors were added in #6141. Errors generally look like this now:

error: failed to parse manifest at `/.../Cargo.toml`

Caused by:
  failed to parse the version requirement `==1` for dependency `plugin`

Caused by:
  the given version requirement is invalid

@ehuss ehuss closed this as completed Dec 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself.
Projects
None yet
Development

No branches or pull requests

5 participants