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

fix(resolve): Dont show locking workspace members #14445

Merged
merged 1 commit into from
Aug 26, 2024
Merged

Conversation

epage
Copy link
Contributor

@epage epage commented Aug 22, 2024

What does this PR try to resolve?

This is for cargo generate-lockfile and when syncing the lockfile with
the manifest.
We still show it for cargo update because of cargo update --workspace.

We hacked around this previously by filtering out the num_pkgs==1 case
for single packages but this didn't help with workspaces.

How should we test and review this PR?

Additional information

This builds on #14440

This is for `cargo generate-lockfile` and when syncing the lockfile with
the manifest.
We still show it for `cargo update` because of `cargo update
--workspace`.

We hacked around this previously by filtering out the `num_pkgs==1` case
for single packages but this didn't help with workspaces.
@rustbot
Copy link
Collaborator

rustbot commented Aug 22, 2024

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added Command-update S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 22, 2024
}

fn with_diff(diff: impl Iterator<Item = PackageDiff>) -> Vec<Self> {
fn with_diff(diff: impl Iterator<Item = PackageDiff>, ws: &Workspace<'_>) -> Vec<Self> {
let member_ids: HashSet<_> = ws.members().map(|p| p.package_id()).collect();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Workspace::is_member instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats annoying, it requires a Package just to do a lookup with PackageId

@@ -787,20 +800,23 @@ struct PackageChange {
package_id: PackageId,
previous_id: Option<PackageId>,
kind: PackageChangeKind,
is_member: Option<bool>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see the necessity of wrapping with an Option here except for representing “not relevant because it is a removed package”. Is that the reason of using it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I wanted to make sure that when I accessed it, this state was clear. At first, I thought I was also going to have to act on it but that didn't end up happening.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The truth is that Cargo actually also locks versions of workspaces members, though I believe users often just don't care.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. When I first did this, the intent was to inform users of relevant information. It can also be confusing to see these mesaages. I just made a change to some of my workspaces, removing version and cargo check reported that it downgraded those packages.

@epage
Copy link
Contributor Author

epage commented Aug 23, 2024

This PR had a refactor on it, merging the cargo generate-lockfile and the lockfile sync (e.g. cargo check) reporting but I realized there was a difference that we might want to preserve: cargo generate-lockfile only shows Adds with relevant information to avoid overwhelming the user.

@epage epage force-pushed the locked branch 7 times, most recently from 56fca86 to d2ec764 Compare August 24, 2024 01:17
@weihanglo
Copy link
Member

@bors r+

Thanks!

@bors
Copy link
Contributor

bors commented Aug 26, 2024

📌 Commit d2ec764 has been approved by weihanglo

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 26, 2024
@bors
Copy link
Contributor

bors commented Aug 26, 2024

⌛ Testing commit d2ec764 with merge ef854d2...

@bors
Copy link
Contributor

bors commented Aug 26, 2024

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing ef854d2 to master...

@bors bors merged commit ef854d2 into rust-lang:master Aug 26, 2024
22 checks passed
@epage epage deleted the locked branch August 27, 2024 01:30
bors added a commit that referenced this pull request Aug 27, 2024
fix(resolve): Report incompatible packages with precise Rust version

### What does this PR try to resolve?

In #14401, we reported about MSRV issues as if we were the resolver.  We can be smarter than that though and report precise MSRV information.  This allows us to elevate the message from color from yellow to red.

This is also prep work for telling users when a newer, MSRV-compatible version of a package is available.

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

The report function I added is a little odd because a follow up commit will update it to report when a package is incompatible with rustc when the MSRV resolver is disabled and do this on stable.

### Additional information

This builds on #14445 to improve #14401
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 1, 2024
Update cargo

9 commits in 8f40fc59fb0c8df91c97405785197f3c630304ea..c1fa840a85eca53818895901a53fae34247448b2
2024-08-21 22:37:06 +0000 to 2024-08-29 21:03:53 +0000
- fix(resolve): With `latest` message, differentiate actionable updates (rust-lang/cargo#14461)
- fix(pkgid): Allow open namespaces in PackageIdSpec's (rust-lang/cargo#14467)
- feat(resolve): Report incompatible-with-rustc when MSRV-resolver is disabled (rust-lang/cargo#14459)
- fix(resolve): Report incompatible packages with precise Rust version (rust-lang/cargo#14457)
- fix(resolve): Dont show locking workspace members (rust-lang/cargo#14445)
- Log details of failure if no errors were seen (rust-lang/cargo#14453)
- More helpful missing feature error message (rust-lang/cargo#14436)
- feat: Add matches_prerelease semantic (rust-lang/cargo#14305)
- refactor(update): Prepare for smarter update messages (rust-lang/cargo#14440)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 1, 2024
Update cargo

9 commits in 8f40fc59fb0c8df91c97405785197f3c630304ea..c1fa840a85eca53818895901a53fae34247448b2
2024-08-21 22:37:06 +0000 to 2024-08-29 21:03:53 +0000
- fix(resolve): With `latest` message, differentiate actionable updates (rust-lang/cargo#14461)
- fix(pkgid): Allow open namespaces in PackageIdSpec's (rust-lang/cargo#14467)
- feat(resolve): Report incompatible-with-rustc when MSRV-resolver is disabled (rust-lang/cargo#14459)
- fix(resolve): Report incompatible packages with precise Rust version (rust-lang/cargo#14457)
- fix(resolve): Dont show locking workspace members (rust-lang/cargo#14445)
- Log details of failure if no errors were seen (rust-lang/cargo#14453)
- More helpful missing feature error message (rust-lang/cargo#14436)
- feat: Add matches_prerelease semantic (rust-lang/cargo#14305)
- refactor(update): Prepare for smarter update messages (rust-lang/cargo#14440)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 1, 2024
Update cargo

9 commits in 8f40fc59fb0c8df91c97405785197f3c630304ea..c1fa840a85eca53818895901a53fae34247448b2
2024-08-21 22:37:06 +0000 to 2024-08-29 21:03:53 +0000
- fix(resolve): With `latest` message, differentiate actionable updates (rust-lang/cargo#14461)
- fix(pkgid): Allow open namespaces in PackageIdSpec's (rust-lang/cargo#14467)
- feat(resolve): Report incompatible-with-rustc when MSRV-resolver is disabled (rust-lang/cargo#14459)
- fix(resolve): Report incompatible packages with precise Rust version (rust-lang/cargo#14457)
- fix(resolve): Dont show locking workspace members (rust-lang/cargo#14445)
- Log details of failure if no errors were seen (rust-lang/cargo#14453)
- More helpful missing feature error message (rust-lang/cargo#14436)
- feat: Add matches_prerelease semantic (rust-lang/cargo#14305)
- refactor(update): Prepare for smarter update messages (rust-lang/cargo#14440)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 1, 2024
Update cargo

9 commits in 8f40fc59fb0c8df91c97405785197f3c630304ea..c1fa840a85eca53818895901a53fae34247448b2
2024-08-21 22:37:06 +0000 to 2024-08-29 21:03:53 +0000
- fix(resolve): With `latest` message, differentiate actionable updates (rust-lang/cargo#14461)
- fix(pkgid): Allow open namespaces in PackageIdSpec's (rust-lang/cargo#14467)
- feat(resolve): Report incompatible-with-rustc when MSRV-resolver is disabled (rust-lang/cargo#14459)
- fix(resolve): Report incompatible packages with precise Rust version (rust-lang/cargo#14457)
- fix(resolve): Dont show locking workspace members (rust-lang/cargo#14445)
- Log details of failure if no errors were seen (rust-lang/cargo#14453)
- More helpful missing feature error message (rust-lang/cargo#14436)
- feat: Add matches_prerelease semantic (rust-lang/cargo#14305)
- refactor(update): Prepare for smarter update messages (rust-lang/cargo#14440)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 2, 2024
Update cargo

9 commits in 8f40fc59fb0c8df91c97405785197f3c630304ea..c1fa840a85eca53818895901a53fae34247448b2
2024-08-21 22:37:06 +0000 to 2024-08-29 21:03:53 +0000
- fix(resolve): With `latest` message, differentiate actionable updates (rust-lang/cargo#14461)
- fix(pkgid): Allow open namespaces in PackageIdSpec's (rust-lang/cargo#14467)
- feat(resolve): Report incompatible-with-rustc when MSRV-resolver is disabled (rust-lang/cargo#14459)
- fix(resolve): Report incompatible packages with precise Rust version (rust-lang/cargo#14457)
- fix(resolve): Dont show locking workspace members (rust-lang/cargo#14445)
- Log details of failure if no errors were seen (rust-lang/cargo#14453)
- More helpful missing feature error message (rust-lang/cargo#14436)
- feat: Add matches_prerelease semantic (rust-lang/cargo#14305)
- refactor(update): Prepare for smarter update messages (rust-lang/cargo#14440)

r? ghost
@rustbot rustbot added this to the 1.83.0 milestone Sep 2, 2024
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 6, 2024
Update cargo

9 commits in 8f40fc59fb0c8df91c97405785197f3c630304ea..c1fa840a85eca53818895901a53fae34247448b2
2024-08-21 22:37:06 +0000 to 2024-08-29 21:03:53 +0000
- fix(resolve): With `latest` message, differentiate actionable updates (rust-lang/cargo#14461)
- fix(pkgid): Allow open namespaces in PackageIdSpec's (rust-lang/cargo#14467)
- feat(resolve): Report incompatible-with-rustc when MSRV-resolver is disabled (rust-lang/cargo#14459)
- fix(resolve): Report incompatible packages with precise Rust version (rust-lang/cargo#14457)
- fix(resolve): Dont show locking workspace members (rust-lang/cargo#14445)
- Log details of failure if no errors were seen (rust-lang/cargo#14453)
- More helpful missing feature error message (rust-lang/cargo#14436)
- feat: Add matches_prerelease semantic (rust-lang/cargo#14305)
- refactor(update): Prepare for smarter update messages (rust-lang/cargo#14440)

r? ghost
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Sep 25, 2024
Update cargo

9 commits in 8f40fc59fb0c8df91c97405785197f3c630304ea..c1fa840a85eca53818895901a53fae34247448b2
2024-08-21 22:37:06 +0000 to 2024-08-29 21:03:53 +0000
- fix(resolve): With `latest` message, differentiate actionable updates (rust-lang/cargo#14461)
- fix(pkgid): Allow open namespaces in PackageIdSpec's (rust-lang/cargo#14467)
- feat(resolve): Report incompatible-with-rustc when MSRV-resolver is disabled (rust-lang/cargo#14459)
- fix(resolve): Report incompatible packages with precise Rust version (rust-lang/cargo#14457)
- fix(resolve): Dont show locking workspace members (rust-lang/cargo#14445)
- Log details of failure if no errors were seen (rust-lang/cargo#14453)
- More helpful missing feature error message (rust-lang/cargo#14436)
- feat: Add matches_prerelease semantic (rust-lang/cargo#14305)
- refactor(update): Prepare for smarter update messages (rust-lang/cargo#14440)

r? ghost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-update 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.

4 participants