-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Unkind error message failing patch non-existing package with a prerelease version package #12315
Comments
cargo/src/cargo/core/resolver/errors.rs Lines 226 to 228 in 5febbe5
is intended and this is used to judge "dependency" specifies the prerelease version package. Using this, printing kind error message for mistakes in "dependency". (see #12316 and its CI fails) I suggest improving error messages for "patch" specifies prerelease versions. |
I agree we should use |
Feel free to hack on this if anyone is interested in it. @rustbot label -S-triage +S-accepted +A-errors +A-dependency-resolution +A-semver |
Prerelease candidates error message ### What does this PR try to resolve? Error messages reporting on versions that do not match the request incorrectly ignore pre-release versions. This is because the version requirement `"*"` cannot match prerelease versions. #12315 ### How should we test and review this PR? Sorry for the large amount of white space changes, fmt got to fmt. 🤷♂️ The process was: - Revise commit from #12316 (thanks to `@loloicci)` that change the requirement from `"*"` to `Any` - Move the handling of our special "did you mean to specify a pre-release" code and update tests - some small re-factoring ### Additional information The old "did you mean to specify a pre-release" #7191 check only occurred when version requirement does not match any versions and you depended on a package that did not have any non-prerelease versions. Making it rarely useful. The new one will appear any time your version requirement does not match any versions and the package does have pre-release versions. Which may be too common. I'm open to suggestions for better heuristic. It's also not clear that the new message make sense in the case of patched versions.
Problem
Trying to patch a stable version package (0.1.0) with prerelease version one (0.1.1-prerelease) fails with an unkind error message if there are no other matching repositories. For example,
root's Cargo.toml:
cargo-mylib's Cargo.toml
cargo update
in this cargo-mybin fails withThis message says wrong information that no matching package was found. This is because
cargo/src/cargo/core/resolver/errors.rs
Lines 226 to 228 in 5febbe5
Steps
cargo update
on itPossible Solution(s)
use
OptVersionReq::Any
instead ofsemver::VersionReq::parse("*").unwrap()
incargo/src/cargo/core/resolver/errors.rs
Lines 226 to 228 in 5febbe5
Notes
No response
Version
The text was updated successfully, but these errors were encountered: