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

improve error message for unmatched prerelease dependencies #7191

Merged
merged 2 commits into from
Aug 1, 2019

Conversation

debris
Copy link
Contributor

@debris debris commented Jul 30, 2019

fixes #7007

error message before:

error: no matching package named `a` found
location searched: [..]
perhaps you meant: a
required by package `b v0.1.0 ([..])`

error message now

error: no matching package named `a` found
location searched: [..]
prerelease package needs to be specified explicitly
a = { version = "0.1.1-alpha.0" }
required by package `b v0.1.0 ([..])`

@Eh2406
Copy link
Contributor

Eh2406 commented Jul 30, 2019

@debris thanks for the PR!
needs a cargo fmt but lgtm. @alexcrichton thoughts?

@alexcrichton
Copy link
Member

Seems reasonable to me! Any and all improvements to error messages always sounds good to me :)

@ehuss
Copy link
Contributor

ehuss commented Jul 31, 2019

The nightly errors on CI should now be fixed.

@alexcrichton
Copy link
Member

@bors: r=Eh2406

@bors
Copy link
Contributor

bors commented Aug 1, 2019

📌 Commit 577968e has been approved by Eh2406

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 1, 2019
@bors
Copy link
Contributor

bors commented Aug 1, 2019

⌛ Testing commit 577968e with merge 85b9566...

bors added a commit that referenced this pull request Aug 1, 2019
improve error message for unmatched prerelease dependencies

fixes #7007

error message before:

```
error: no matching package named `a` found
location searched: [..]
perhaps you meant: a
required by package `b v0.1.0 ([..])`
```

error message now

```
error: no matching package named `a` found
location searched: [..]
prerelease package needs to be specified explicitly
a = { version = "0.1.1-alpha.0" }
required by package `b v0.1.0 ([..])`
```
@bors
Copy link
Contributor

bors commented Aug 1, 2019

☀️ Test successful - checks-azure
Approved by: Eh2406
Pushing 85b9566 to master...

@bors bors merged commit 577968e into rust-lang:master Aug 1, 2019
@bors bors mentioned this pull request Aug 1, 2019
@debris debris deleted the prerelease_error_message branch August 6, 2019 12:13
bors added a commit to rust-lang/rust that referenced this pull request Aug 8, 2019
Update cargo

9 commits in 26092da337b948719549cd5ed3d1051fd847afd7..42a8c0adf91323c01228268c651aef5366b25b69
2019-07-31 23:24:32 +0000 to 2019-08-07 20:41:07 +0000
- Add support for customizing JSON diagnostics from Cargo (rust-lang/cargo#7214)
- Bump rustfix (rust-lang/cargo#7221)
- Fix remap-path-prefix from failing. (rust-lang/cargo#7219)
- Clean up build script stuff and documentation. (rust-lang/cargo#7215)
- Remove debug panic in package-features. (rust-lang/cargo#7213)
- Fix an old test. (rust-lang/cargo#7208)
- Remove unused AstBuilder (rust-lang/cargo#7210)
- Revert "Release a jobserver token while locking a file" (rust-lang/cargo#7201)
- improve error message for unmatched prerelease dependencies (rust-lang/cargo#7191)
@ehuss ehuss added this to the 1.38.0 milestone Feb 6, 2022
bors added a commit that referenced this pull request Sep 14, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[workspace] Prereleases with path dependencies fail
5 participants