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

Mismatch against yanked version doesn't inform user about yank #4260

Closed
crumblingstatue opened this issue Jul 8, 2017 · 4 comments · Fixed by #14923
Closed

Mismatch against yanked version doesn't inform user about yank #4260

crumblingstatue opened this issue Jul 8, 2017 · 4 comments · Fixed by #14923
Labels
A-dependency-resolution Area: dependency resolution and the resolver A-diagnostics Area: Error and warning messages generated by Cargo itself. S-triage Status: This issue is waiting on initial triage.

Comments

@crumblingstatue
Copy link

Depending on bincode = "1.0.0-alpha7" produces the following error:

no matching version `^1.0.0-alpha7` found for package `bincode` (required by `whatever`)
location searched: registry https://github.com/rust-lang/crates.io-index
versions found: 0.8.0, 0.7.0, 0.6.1, ...

It doesn't mention the fact that there is a 1.0.0-alpha7, but it has been yanked.

This can leave the user confused about whether they mistyped something, or they are just trying to depend on a yanked version.

Semi-related: https://github.com/onur/docs.rs/issues/112#issuecomment-313868337

@alexcrichton alexcrichton added the A-diagnostics Area: Error and warning messages generated by Cargo itself. label Jul 10, 2017
@epage epage added A-dependency-resolution Area: dependency resolution and the resolver S-triage Status: This issue is waiting on initial triage. labels Oct 13, 2023
@epage
Copy link
Contributor

epage commented Oct 14, 2023

Looks like the error hasn't improved in the intervening time

#!/usr/bin/env nargo
```cargo
[dependencies]
bincode = "=1.0.0-alpha7"

fn main () {}

```console
$ ./cargo-4260.rs
warning: `package.edition` is unspecified, defaulting to `2021`
    Updating crates.io index
error: failed to select a version for the requirement `bincode = "=1.0.0-alpha7"`
candidate versions found which didn't match: 2.0.0-rc.3, 2.0.0-rc.2, 2.0.0-rc.1, ...
location searched: crates.io index
required by package `cargo-4260 v0.0.0 (/home/epage/src/personal/dump)`
if you are looking for the prerelease package it needs to be specified explicitly
    bincode = { version = "2.0.0-rc.3" }
perhaps a crate was updated and forgotten to be re-vendored?

@Eh2406 how bad would this be to improve the error in this case?

@Eh2406
Copy link
Contributor

Eh2406 commented Oct 14, 2023

The resolver is reporting that the package doesn't exist, because it got filtered out and a much lower level of abstraction.
This is part of the work in https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/better.20error.20messages.20for.20filtered.20versions.2E

@glandium
Copy link
Contributor

glandium commented Feb 13, 2024

Not sure I should open a separate issue, but relatedly, the error from cargo update -p crate --precise yanked-version says error: no matching package named "crate" found, which is confusing.

@epage
Copy link
Contributor

epage commented Feb 13, 2024

Allowing --precise with yanked packages was implemented in #13333. It is currently unstable but we expect to stabilize it soon.

epage added a commit to epage/cargo that referenced this issue Dec 11, 2024
The user likely intended what they said and we should tell them why it
didn't work.
Rejected versions also imply alt versions below them.

Fixes rust-lang#4260
epage added a commit to epage/cargo that referenced this issue Dec 11, 2024
The user likely intended what they said and we should tell them why it
didn't work.
Rejected versions also imply alt versions below them.

Fixes rust-lang#4260
github-merge-queue bot pushed a commit that referenced this issue Dec 12, 2024
…14923)

### What does this PR try to resolve?

The user likely intended what they said and we should tell them why it
didn't work.
Rejected versions also imply alt versions below them.

Fixes #4260

In changing the errors from alt-versions to rejected-versions, I found
part of the old error message was better and changed the message
introduced in #14897 from matching alt-names to alt-versions.

This includes the test for #14921. The "fix" was done before this
because as it was part of the refactors in prep for this.

### How should we test and review this PR?

### Additional information

Next steps after this are to still produce an
`IndexSummary::Unsupported` even if there are deserialization errors, so
long as we know the name and version which should take care of #10623
and #14894.
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. S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants