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

Use -Z minimal-versions to test MSRV #2120

Closed
MarijnS95 opened this issue Jan 31, 2024 · 1 comment · Fixed by #2121
Closed

Use -Z minimal-versions to test MSRV #2120

MarijnS95 opened this issue Jan 31, 2024 · 1 comment · Fixed by #2121

Comments

@MarijnS95
Copy link
Contributor

In johannesvollmer/exrs#231 (CC @johannesvollmer) we're stripping out an upper-version bound for a dependency to allow it to be used across other dependencies, and reimplementing the MSRV test by -Zminimal-versions.

There was a request to make sure that the exrs change in question doesn't affect this image crate - especially its MSRV.

It however seems unnecessarily complicated to contribute to Cargo.lock.msrv or to reproduce the versions used by it in downstream crates. The file that's checked in seems to be a random snapshot from some moment in time - possibly with manual downgrades via text editing or cargo update --precise .. calls to downgrade specific (transitive) dependencies - that is not something a consume or image can easily cobble up except for trial-and-error downgrading dependencies, or swinging the big -Zminimal-versions hammer.

Even if downstream consumer crates decide to use -Zminimal-versions, they'll be greeted by a compiler failure because the image crate uses bytemuck::pow_read_unaligned() which only became available in bytemuck 1.8.0: 61ec877. Hence the big advantage of this is that, besides satisfying the MSRV check, downstream crates can safely use -Zminimal-versions and be sure that at least image and its dependencies continue to compile.

This approach only seems to have been discussed very briefly in #1433 (comment) and was deemed "shouldn't be used in production either", perhaps because it is a nightly-only feature?

@fintelia
Copy link
Contributor

Thanks for proposing this!

The strategy of checking in Cargo.lock.msrv was adopted in a rush to get CI working again after a few of our dependencies decided to switch to much more aggressive MSRV policies than we use. You are correct that it was created via a couple specific cargo update --precise .. calls. Using minimal versions is clearly a better option now that the crate actually supports that 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants