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

Sparse registry causes incorrect msrv detection [consider after release of Rust 1.70] #703

Closed
ecton opened this issue May 28, 2023 · 2 comments

Comments

@ecton
Copy link

ecton commented May 28, 2023

In my ~/cargo/config.toml, I've included these lines to enable the sparse registry, which is a new feature in 1.68:

[registries.crates-io]
protocol = "sparse"

When running cargo msrv on a project whose real MSRV is 1.65.0, I get this output when it's testing versions before 1.68:

 error: failed to get `criterion` as a dependency of package `benchmarks v0.1.0 (/home/ecton/projects/objectmap/benchmarks)`                                                     │
│                                                                                                                                                                                 │
│ Caused by:                                                                                                                                                                      │
│   failed to load source for dependency `criterion`                                                                                                                              │
│                                                                                                                                                                                 │
│ Caused by:                                                                                                                                                                      │
│   Unable to update registry `crates-io`                                                                                                                                         │
│                                                                                                                                                                                 │
│ Caused by:                                                                                                                                                                      │
│   usage of sparse registries requires `-Z sparse-registry`    

I have no idea if cargo-msrv can instruct cargo to not use the sparse registry. If not, maybe the tool can detect that the setting is enabled and display a warning or error.

Disabling the sparse protocol allows the correct MSRV to be detected.

I couldn't find an existing issue where this has been reported -- sorry if this is a duplicate!

Update: A friend pointed out to me that in 1.70 (~4 days from now), the sparse protocol will be enabled by default. This means that once I have 1.70 as my default toolchain, I can remove the lines in config.toml, which causes this issue to be a non-issue.

@foresterre
Copy link
Owner

Update: A friend pointed out to me that in 1.70 (~4 days from now), the sparse protocol will be enabled by default. This means that once I have 1.70 as my default toolchain, I can remove the lines in config.toml, which causes this issue to be a non-issue.

In that case I'll wait for 1.70 to be released; and will assess whether support should be added separately after the release.

Regardless, thanks for the report!

@foresterre foresterre changed the title Sparse registry causes incorrect msrv detection Sparse registry causes incorrect msrv detection [consider after release of Rust 1.70] May 30, 2023
@luukvanderduim
Copy link

luukvanderduim commented Aug 3, 2023

With cargo-msrv 0.15.1 I see "invalid" MSRV.
(Not sure if the advice is really invalid, it concerns a hiatus in a few versions)

When running in the workspace of atspi 0.18

Check for toolchain '1.67.1-x86_64-unknown-linux-gnu' failed with:
┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ error: failed to get `enumflags2` as a dependency of package `atspi-common v0.2.0 (/atspi/atspi-common)`                                                                        │
│                                                                                                                                                                                                                  │
│ Caused by:                                                                                                                                                                                                       │
│   failed to load source for dependency `enumflags2`                                                                                                                                                              │
│                                                                                                                                                                                                                  │
│ Caused by:                                                                                                                                                                                                       │
│   Unable to update registry `crates-io`                                                                                                                                                                          │
│                                                                                                                                                                                                                  │
│ Caused by:                                                                                                                                                                                                       │
│   usage of sparse registries requires `-Z sparse-registry`                                                                                                                                                       │
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Check for toolchain '1.69.0-x86_64-unknown-linux-gnu' succeeded
Check for toolchain '1.68.2-x86_64-unknown-linux-gnu' succeeded
  Finished The MSRV is: 1.68.2 

When cargo +1.65.0-x86_64-unknown-linux-gnu check is run manually however, this succeeds.

    Finished dev [unoptimized + debuginfo] target(s) in 0.16s

However:
cargo +1.66.0-x86_64-unknown-linux-gnu check fails:

error: failed to get `enumflags2` as a dependency of package `atspi-common v0.2.0 (/home/luuk/code/atspi-various-doc/atspi/atspi-common)`

Caused by:
  failed to load source for dependency `enumflags2`

Caused by:
  Unable to update registry `crates-io`

Caused by:
  usage of sparse registries requires `-Z sparse-registry`

Versions prior to 1.65 are known to not compile atspi because it uses let - else constructions,

build summaries:
1.65.0 fine
1.66.0 sparse registry requires -Z sparse-registry,
1.67.1 sparse registry requires -Z sparse-registry,
1.68.2 fine
1.69.0 fine
1.70.0 fine
1.71.0 fine

Note that it does not matter if the dev-dependency of enumflags2 is inherited from the workspace or explicitly versioned in-place.

I think the advice on MSRV is sound, however the hiatus is odd and it may be valuable to others to know.

Also, it might be possible I am doing something wrong, in which case I'd be happy to learn.

luukvanderduim added a commit to odilia-app/atspi that referenced this issue Aug 3, 2023
This sets MSRV (Minimum supported Rust version) to toolchain 1.68.2

While v1.65.0 succeeds to compile atspi, 1.66 and 1.67.1 do not.
From 1.68.2 onward building `atspi` succeeds.

For details see my comment in [cargo-msrv](foresterre/cargo-msrv#703 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants