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

feat(resolve): Direct people to working around less optimal MSRV-resolver results #14543

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

epage
Copy link
Contributor

@epage epage commented Sep 14, 2024

What does this PR try to resolve?

In discussing #14414, the general problem of the resolver picking a
version older than a package needs for its MSRV (or lack of one) because of the MSRV of
other packages came up.
This tries to patch over that problem by telling users that a dependency
might be able to be newer than the resolver selected.

The message is fairly generic and might be misread to be about any MSRV
update which an MSRV fallback strategy allows, which would make the
count off.
The reason it is so generic is we don't know with precision why it was
held back

  • Direct dependents may have a non-semver upper bound on the version as
    we aren't trying to unify the version requirements across direct
    dependents at this time
  • A dependency could have removed a feature without making a breaking
    change
    • This seems like it should instead be an error but thats a
      conversation for another day
  • The user enabled -Zminimal-versions
    • This is now detected and the message skipped

Note: separate from this, we may also print the status suffix for this
case if the package was not selected for update (e.g. passing
--workspace).

How should we test and review this PR?

Additional information

@rustbot
Copy link
Collaborator

rustbot commented Sep 14, 2024

r? @ehuss

rustbot has assigned @ehuss.
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 Sep 14, 2024
@epage epage marked this pull request as draft September 14, 2024 03:43
Comment on lines 700 to 701
[ADDING] dep1 v0.1.3 (available: v0.1.8)
[NOTE] 1 package may have a higher, compatible versions. To update it, run `cargo update <name> --precise <version>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an example of where it might show up for a non-MSRV case (and the suggested action will fail)

@epage
Copy link
Contributor Author

epage commented Sep 14, 2024

@joshtriplett this is a first pass at supporting a summary message and what wording we might use.

@bors
Copy link
Contributor

bors commented Sep 21, 2024

☔ The latest upstream changes (presumably #14568) made this pull request unmergeable. Please resolve the merge conflicts.

bors added a commit that referenced this pull request Sep 24, 2024
fix(resolve): Improve multi-MSRV workspaces

### What does this PR try to resolve?

We do this by resolving for a package version that is compatible
with the most number of MSRVs within a workspace.

If a version requirement is just right, every package will get the
highest MSRV-compatible dependency.

If its too high, packages will get MSRV-incompatible dependency
versions.
This will happen regardless of what we do due to the nature of
`"fallback"`.

If its too low, packages with higher MSRVs will get older-than-necessary
dependency versions.
This is similar to the "some with and without MSRV" workspaces.
When locking dependencies, we do report to users when newer MSRV/SemVer
compatible dependencies are available to help guide them to upgrading if
desired.

Fixes #14414

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

Is this the right behavior?
- This feature is unstable and letting people try it is one way to determine that
- A concern was raised within the Cargo team about new users with workspace member MSRVs all set to latest having someone ask them to lower an MSRV and them dealing with staler-than-required dependencies
  - At this point, there seems to be agreement on #14414 being a problem, the resolver magically fixing this is unlikely to happen for the foreseeable future, and this does fix it with the potential for user confusion.  From my understanding of those conversations, they are mostly in the area of UX, like with #14543.  Rather than blocking on that discussion, this moves forward with the implementation.

### Additional information
…lver results

In discussing rust-lang#14414, the general problem of the resolver picking a
version older than a package needs for its MSRV (or lack of one) because of the MSRV of
other packages came up.
This tries to patch over that problem by telling users that a dependency
might be able to be newer than the resolver selected.

The message is fairly generic and might be misread to be about any MSRV
update which an MSRV `fallback` strategy allows, which would make the
count off.
The reason it is so generic is we don't know with precision why it was
held back
- Direct dependents may have a non-semver upper bound on the version as
  we aren't trying to unify the version requirements across direct
  dependents at this time
- A dependency could have removed a feature without making a breaking
  change
  - This seems like it should instead be an error but thats a
    conversation for another day
- ~~The user enabled `-Zminimal-versions`~~
  - This is now detected and the message skipped

Note: separate from this, we may also print the status suffix for this
case if the package was not selected for update (e.g. passing
`--workspace`).
src/cargo/ops/cargo_update.rs Outdated Show resolved Hide resolved
tests/testsuite/workspaces.rs Outdated Show resolved Hide resolved
Comment on lines 1236 to +1243
[LOCKING] 9 packages to latest Rust 1.60.0 compatible versions
[ADDING] dep-only-high-incompatible v1.75.0 (requires Rust 1.75.0)
[ADDING] dep-only-low-incompatible v1.75.0 (requires Rust 1.75.0)
[ADDING] dep-only-high-compatible v1.55.0 (available: v1.65.0)
[ADDING] dep-only-high-incompatible v1.55.0 (available: v1.75.0, requires Rust 1.75.0)
[ADDING] dep-only-low-incompatible v1.55.0 (available: v1.75.0, requires Rust 1.75.0)
[ADDING] dep-only-unset-compatible v1.55.0 (available: v1.75.0)
[ADDING] dep-only-unset-incompatible v1.2345.0 (requires Rust 1.2345.0)
[ADDING] dep-shared-incompatible v1.75.0 (requires Rust 1.75.0)
[NOTE] 2 packages may have a higher, compatible version. To update them, run `cargo update <name> --precise <version>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For me, this message is vague to the point of being unhelpful.

Copy link
Member

@joshtriplett joshtriplett Sep 30, 2024

Choose a reason for hiding this comment

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

In the case where we're already showing verbose messages about all the individual crates, I agree. Could we show it only if there are messages about possible upgrades that we're currently hiding because of the verbosity level?

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 sounding like the message we already have

"pass `--verbose` to see {unchanged_behind} unchanged dependencies behind latest"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-update S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants