fix(resolver): Prefer MSRV, rather than ignore incompatible by epage · Pull Request #12950 · rust-lang/cargo
epage
mentioned this pull request
This is another experiment for rust-lang#9930. Comparing preferring over exclusively using MSRV compatible: Benefits - Better error messages - `--ignore-rust-version` is implicitly sticky Downsides - Can't backtrack for MSRV compatible version - Still requires workspace-wide MSRV (compared to our desired end state of declaring MSRV as yet another dependency) This builds on rust-lang#12930
bors
added
S-waiting-on-bors
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.labels
Nov 14, 2023
epage
mentioned this pull request
bors added a commit that referenced this pull request
Nov 28, 2023fix(resolver): De-prioritize no-rust-version in MSRV resolver ### What does this PR try to resolve? This is a corner case without a good answer. As such, this change leans on some happy-path entries existing and preferring those. ### How should we test and review this PR? ### Additional information This was originally discussed around the time of #12950 but was held off. When working on this, I was considering other heuristics like - If a future version has an MSRV, assume that it applies also to the current version - This can be added in the future - We likely would want to consider an alternative value, like inferring the rust-version from the manifest or the rust-version used from publish - Sort no-MSRV versions of a package by minimal versions - The lower the version, the more likely it is to be compatible - This likely could apply to incompatible MSRVs (or we could reverse-sort those by rust-version) but those will error anyways without `--ignore-rust-version`, so I decided against these - I realized this was a backdoor to minimal versions for dependencies without a MSRV and that the community support isn't there for that yet to be a high enough quality of an experience
epage
mentioned this pull request
27 tasks
epage added a commit to epage/cargo that referenced this pull request
Apr 23, 2024We last tweaked this logic in rust-lang#13066. However, we noticed this was inconsistent with `cargo add` in automatically selecting version requirements. It looks like this is a revert of rust-lang#13066, taking us back to the behavior in rust-lang#12950. In rust-lang#12950 there was a concern about the proliferation of no-MSRV and whether we should de-prioritize those to make the chance of success more likely. There are no right answes here, only which wrong answer is ok enough. - Do we treat lack of rust version as `rust-version = "*"` as some people expect or do we try to be smart? - If a user adds or removes `rust-version`, how should that affect the priority? One piece of new information is that the RFC for this has us trying to fill the no-MSRV gap with `rust-version = some-value-representing-the-current-toolchain>`.
epage
mentioned this pull request
epage added a commit to epage/cargo that referenced this pull request
Apr 29, 2024We last tweaked this logic in rust-lang#13066. However, we noticed this was inconsistent with `cargo add` in automatically selecting version requirements. It looks like this is a revert of rust-lang#13066, taking us back to the behavior in rust-lang#12950. In rust-lang#12950 there was a concern about the proliferation of no-MSRV and whether we should de-prioritize those to make the chance of success more likely. There are no right answes here, only which wrong answer is ok enough. - Do we treat lack of rust version as `rust-version = "*"` as some people expect or do we try to be smart? - If a user adds or removes `rust-version`, how should that affect the priority? One piece of new information is that the RFC for this has us trying to fill the no-MSRV gap with `rust-version = some-value-representing-the-current-toolchain>`.
bors added a commit that referenced this pull request
May 1, 2024fix(resolver): Treat unset MSRV as compatible ### What does this PR try to resolve? Have the resolver treat no-MSRV as `rust-version = "*"`, like `cargo add` does for version-requirement selection ### How should we test and review this PR? We last tweaked this logic in #13066. However, we noticed this was inconsistent with `cargo add` in automatically selecting version requirements. It looks like this is a revert of #13066, taking us back to the behavior in #12950. In #12950 there was a concern about the proliferation of no-MSRV and whether we should de-prioritize those to make the chance of success more likely. There are no right answes here, only which wrong answer is ok enough. - Do we treat lack of rust version as `rust-version = "*"` as some people expect or do we try to be smart? - If a user adds or removes `rust-version`, how should that affect the priority? One piece of new information is that the RFC for this has us trying to fill the no-MSRV gap with `rust-version = some-value-representing-the-current-toolchain>`. See also #9930 (comment) r? `@Eh2406` ### Additional information
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters