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

Crate version missing based on compiler version #10688

Closed
xNxExOx opened this issue May 21, 2022 · 4 comments
Closed

Crate version missing based on compiler version #10688

xNxExOx opened this issue May 21, 2022 · 4 comments
Labels
C-bug Category: bug

Comments

@xNxExOx
Copy link

xNxExOx commented May 21, 2022

Problem

error: failed to select a version for the requirement `egui = "^0.18"`
candidate versions found which didn't match: 0.17.0, 0.16.1, 0.16.0, ...
egui = { version = "0.18", optional = true }
egui_glium = { version = "0.18", optional = true }
glium = { version = "0.31", optional = true }
egui_demo_lib = { version = "0.18", optional = true, features = ["serde"] }
clipboard-win = { version = "4", optional = true }

but versions 0.18.0 and 0.18.1 existed at the time

Steps

  1. use rustc 1.60
  2. create crate with feature that depends on the crates listed above. (egui is probably enough, but I did not test it)
  3. try to build it and it will (hopefully) fail with same error I did get

Possible Solution(s)

I solved it by updating with rustup
nightly-i686-pc-windows-msvc updated - rustc 1.63.0-nightly (e6a4afc3a 2022-05-20) (from rustc 1.60.0-nightly (ee5d8d37b 2022-01-17))

Notes

I am not 100% sure if this is an cargo issue, because updating compiler did help, but I think that crate resolution trough Cargo.toml is part of cargo, and did not find any about missing crate version in either issues.

I have no easy way to test it (deleting rust and downloading another version for 30 minutes is not a good option).

To be clear failing is not an issue, but the error message is. If the message would say that newer rustc version is required, instead of crate version not found it would be clear what is going on.

I found out about the upgrade by trying version 0.17 which by the error message exist, and have the change I wanted, and then compilation failed saying one of crates needs at least rustc 1.61, without that I would not even think about updating, because I did not see any interesting feature in the release notes. And after updating I tried if the version 0.18 did exist, and it did.

Please let me know if it is rustc bug, and I should report it there.

Version

cargo 1.60.0-nightly (06b9d3174 2022-01-11)
release: 1.60.0-nightly
commit-hash: 06b9d31743210b788b130c8a484c2838afa6fc27
commit-date: 2022-01-11
host: x86_64-pc-windows-msvc
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:Schannel)
os: Windows 10.0.19044 (Windows 10 Pro) [64-bit]
@xNxExOx xNxExOx added the C-bug Category: bug label May 21, 2022
@Eh2406
Copy link
Contributor

Eh2406 commented May 21, 2022

This is an issue with Cargo, but not one that's easy to fix.
The issue comes because egui uses the new dep: syntax.
Older Cargos don't know how to interpret this syntax and so skip parsing the version.
Cargo could error on versions that they don't know how to interpret, but then you would be unable to build older versions using an older cargo just because newer versions used a newer feature.
The correct solution here is for Cargo to keep track of a reason why any given package/version/feature cannot be selected and display it when relevant. Unfortunately the "when relevant" hard is a really hard feature. There are often hundreds of "reasons" that relate to the final resolution/error, only a handful of which are actually interesting to the user.
We might be able to make incremental progress on these simple cases, but I am saving my effort for the multi year project of using pubgrub for our error messages.

@xNxExOx
Copy link
Author

xNxExOx commented May 21, 2022

Thank you for explanation, one of the main reasons why I was not sure if it is related to cargo, or rustc was that cargo version is still 1.60, so I guess it did not get updated by rustup.
Unless the file will not start with required version to parse it, I do not think there is any reliable way to do forward compatibility checks :(

@epage
Copy link
Contributor

epage commented May 22, 2022

btw we have #10623 for tracking improving the usability of the errors in this context

@xNxExOx
Copy link
Author

xNxExOx commented May 22, 2022

🤔 interesting that githug did not find it, I guess this one can be closed then?

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

No branches or pull requests

4 participants
@epage @xNxExOx @Eh2406 and others