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

Poor error from cargo update --precise when upgrading to pre-release #12579

Open
eopb opened this issue Aug 28, 2023 · 2 comments
Open

Poor error from cargo update --precise when upgrading to pre-release #12579

eopb opened this issue Aug 28, 2023 · 2 comments
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@eopb
Copy link
Contributor

eopb commented Aug 28, 2023

Problem

Starting with a working project that depends on cargo-pretag-version-issue-test = "0.1.0", running cargo update -p cargo-pretag-version-issue-test --precise 0.1.1-pre0 returns an unhelpful error message.

> cargo update -p cargo-pretag-version-issue-test --precise 0.1.1-pre0
    Updating crates.io index
error: no matching package named `cargo-pretag-version-issue-test` found
location searched: registry `crates-io`
required by package `tmp-08luyo v0.1.0 (/home/ethan/.cache/cargo-temp/tmp-08luyo)`

Steps

I created cargo-pretag-version-issue-test to demonstrate this issue. It has two versions, 0.1.0 and 0.1.1-pre0.

> cargo new issue
     Created binary (application) `issue` package
> cargo add cargo-pretag-version-issue-test
    Updating crates.io index
      Adding cargo-pretag-version-issue-test v0.1.0 to dependencies.
    Updating crates.io index
> cargo tree
issue v0.1.0 (/home/ethan/.cache/cargo-temp/issue)
└── cargo-pretag-version-issue-test v0.1.0
> cargo update -p cargo-pretag-version-issue-test --precise 0.1.1-pre0
    Updating crates.io index
error: no matching package named `cargo-pretag-version-issue-test` found
location searched: registry `crates-io`
required by package `issue v0.1.0 (/home/ethan/.cache/cargo-temp/issue)`

Possible Solution(s)

Either,

  • Allow upgrading to pre-release versions via cargo update --precise

or

  • Display a reason why the version could not be selected rather than saying it could not be found

Notes

No response

Version

Tested on both

cargo 1.72.0 (103a7ff2e 2023-08-15)
release: 1.72.0
commit-hash: 103a7ff2ee7678d34f34d778614c5eb2525ae9de
commit-date: 2023-08-15
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.1.2-DEV (sys:0.4.63+curl-8.1.2 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: NixOS 23.5.0 [64-bit]

and

cargo 1.74.0-nightly (925280f02 2023-08-25)
release: 1.74.0-nightly
commit-hash: 925280f028db3a322935e040719a0754703947cf
commit-date: 2023-08-25
host: x86_64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.2.1-DEV (sys:0.4.65+curl-8.2.1 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: NixOS 23.5.0 [64-bit]
@eopb eopb added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Aug 28, 2023
@eopb eopb changed the title cargo update --precise unable to upgrade to pre-release Poor error from cargo update --precise when upgrading to pre-release Aug 28, 2023
@ehuss
Copy link
Contributor

ehuss commented Aug 29, 2023

Per a brief discussion on Zulip at https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Semver.20compatible.20pre-release.20versions.20.28maybe.20pre-RFC.29, the changes related to #12425 may change it so that cargo update -p foo --precise 1.0.0-alpha will start working (by changing Cargo.toml to the pre-release version).

If that happens, I'm not sure if it is worth putting effort into improving the error message. It probably wouldn't hurt, but I'm not sure how complex that would be.

@eopb
Copy link
Contributor Author

eopb commented Jan 14, 2024

#13290 also proposes changes to the behavior of this operation. This error can probably be replaced by an unstable feature warning as part of the work on precise_pre_releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants