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

Bugfix for rust-lang/cargo#3202 #96

Merged
merged 2 commits into from
Oct 17, 2016
Merged

Bugfix for rust-lang/cargo#3202 #96

merged 2 commits into from
Oct 17, 2016

Conversation

steveklabnik
Copy link
Contributor

We improperly assumed that if we had a wildcard patch version, we must
have a non-wildcard minor version. This is actually incorrect.

We improperly assumed that if we had a wildcard patch version, we must
have a non-wildcard minor version. This is actually incorrect.

This bug has been present in semver since at least the 0.2 series, but
`cargo build` never happend to invoke Display for Predicate. The bug
manifested in newer Cargos because in 0.5, we do call Display for
Predicate.
@steveklabnik
Copy link
Contributor Author

While this fixes the panic, it exposes another bug:

[steve@becoming cargo (master)]$ cargo build
    Updating git repository `file:///home/steve/src/semver`
   Compiling semver v0.5.0 (file:///home/steve/src/semver?branch=cargo3202#2719cb6d)
   Compiling cargo v0.14.0 (file:///home/steve/src/cargo)
    Finished debug [unoptimized + debuginfo] target(s) in 47.90 secs
[steve@becoming cargo (master)]$ cd ~/src/foo
[steve@becoming foo (master)]$ ~/src/cargo/target/debug/cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
error: no matching package named `semver` found (required by `foo`)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: 0.*.*
versions found: 0.5.0, 0.4.1, 0.4.0, ...

@steveklabnik
Copy link
Contributor Author

I am confused as to why this fix works; that is, the logic is clearly wrong, but these lines were identical in v0.2.3.

and indeed this test fails:

---- version_req::test::test_cargo3202 stdout ----
    matches: Predicate { op: Wildcard(Patch), major: 0, minor: None, patch: None, pre: [] }, Version { major: 0, minor: 5, patch: 0, pre: [], build: [] }
thread 'version_req::test::test_cargo3202' panicked at 'did not match 0.5.0', src/version_req.rs:515

so why did it actually work before?

@steveklabnik steveklabnik merged commit 9ea93f3 into master Oct 17, 2016
@steveklabnik steveklabnik deleted the cargo3202 branch October 17, 2016 18:39
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

Successfully merging this pull request may close these issues.

1 participant