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

"all possible versions conflict with previously selected packages" error is not giving the appropriate diagnostic #10189

Open
CBenoit opened this issue Dec 10, 2021 · 1 comment
Labels
A-dependency-resolution Area: dependency resolution and the resolver A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug

Comments

@CBenoit
Copy link

CBenoit commented Dec 10, 2021

Problem

I'm getting the "all possible versions conflict with previously selected packages" error even though there are valid versions available according to the diagnostic:

error: failed to select a version for `memchr`.
    ... required by package `nom v6.2.1`
    ... which satisfies dependency `nom = "^6.2.1"` of package `saphir v2.8.2 (https://github.com/CBenoit/saphir?branch=hyper-update#dff5d11a)`
    ... which satisfies git dependency `saphir` (locked to 2.8.2) of package `devolutions-gateway v2021.1.7 ([…]/devolutions-gateway/devolutions-gateway)`
versions that meet the requirements `>=2.0, <2.4` are: 2.3.4, 2.3.3, 2.3.2, 2.3.0, 2.2.1, 2.2.0, 2.1.3, 2.1.2, 2.1.1, 2.1.0, 2.0.2, 2.0.1, 2.0.0

all possible versions conflict with previously selected packages.

  previously selected package `memchr v2.4.0`
    ... which satisfies dependency `memchr = "^2.2"` of package `futures-util v0.3.18`
    ... which satisfies dependency `futures-util = "^0.3"` of package `async-tungstenite v0.16.1`
    ... which satisfies dependency `async-tungstenite = "^0.16.1"` of package `jetsocat v2021.1.7 ([…]/devolutions-gateway/jetsocat)`

failed to select a version for `memchr` which could resolve this conflict

Looking at this diagnostic, I understand that memchr v2.3.4 would satisfy both >=2.0, <2.4 and memchr = "^2.2" and no error should occurs.

In fact, the real issue is that os_str_bytes = "^6.0", which is depended on by some other package, is requiring memchr = "^2.4", but the diagnostic doesn't include this information.

Steps

git clone --depth=1 --single-branch --branch failing-package-selection [email protected]:Devolutions/devolutions-gateway.git
cd devolutions-gateway
cargo check

Notes

I was able to obtain a useful diagnostic by adding memchr = "~2.3.4" to one of the Cargo.toml:

error: failed to select a version for `memchr`.
    ... required by package `os_str_bytes v6.0.0`
    ... which satisfies dependency `os_str_bytes = "^6.0"` of package `clap v3.0.0-rc.3`
    ... which satisfies dependency `clap = "^3.0.0-rc.3"` of package `tokengen v0.1.0 ([…]/devolutions-gateway/tools/tokengen)`
versions that meet the requirements `^2.4` are: 2.4.1, 2.4.0

all possible versions conflict with previously selected packages.

  previously selected package `memchr v2.3.4`
    ... which satisfies dependency `memchr = "~2.3.4"` of package `devolutions-gateway v2021.1.7 ([…]/devolutions-gateway/devolutions-gateway)`

failed to select a version for `memchr` which could resolve this conflict

Version

cargo 1.57.0 (b2e52d7ca 2021-10-21)
release: 1.57.0
commit-hash: b2e52d7cab0a286ee9fcc0c17510b1e72fcb53eb
commit-date: 2021-10-21
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.79.1-DEV (sys:0.4.49+curl-7.79.1 vendored ssl:OpenSSL/1.1.1l)
os: openSUSE 20211111 [64-bit]
@CBenoit CBenoit added the C-bug Category: bug label Dec 10, 2021
@CBenoit CBenoit changed the title Valid version exists but getting a "all possible versions conflict with previously selected packages" error "all possible versions conflict with previously selected packages" error is not giving the appropriate diagnostic Dec 10, 2021
@Eh2406 Eh2406 added A-dependency-resolution Area: dependency resolution and the resolver A-diagnostics Area: Error and warning messages generated by Cargo itself. labels Dec 10, 2021
@Eh2406
Copy link
Contributor

Eh2406 commented Dec 10, 2021

Yes the resolvers error messages are not good enough. I felt like we had an old issue about it, but the best I can find is #5284.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependency-resolution Area: dependency resolution and the resolver A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants