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: verify msrv with rust-version fields (with cargo-msrv 0.16) #4941

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

Conversation

eitsupi
Copy link
Member

@eitsupi eitsupi commented Oct 9, 2024

Given that cargo's MSRV-aware resolver will soon be enabled by default, MSRV validation will become more and more important.

@eitsupi eitsupi requested a review from max-sixty October 9, 2024 11:09
@eitsupi
Copy link
Member Author

eitsupi commented Oct 9, 2024

It seems that ubuntu-latest is bumped from Ubuntu 22.04 to 24.04 today.
That seems causing test failure.

Edit: Fixed by #4942

@eitsupi eitsupi changed the title chore: verify msrv with cargo-msrv 0.16 fix: verify msrv with rust-version field (with cargo-msrv 0.16) Oct 9, 2024
@eitsupi eitsupi changed the title fix: verify msrv with rust-version field (with cargo-msrv 0.16) fix: verify msrv with rust-version fields (with cargo-msrv 0.16) Oct 9, 2024
@eitsupi
Copy link
Member Author

eitsupi commented Oct 9, 2024

It appears that the MSRV of the entire workspace must be higher than the MSRV of the individual crates.
So here lutra is 1.77.2 and the workspace should not have a lower rust-version than this.
(For me, there is a question whether it is reasonable to make lutra a member of the workspace.)

Sorry, but this was a misunderstanding, see foresterre/cargo-msrv#1023.

@eitsupi
Copy link
Member Author

eitsupi commented Oct 9, 2024

@max-sixty Do you remember why the MSRV checks were only available for nightly builds? To me this seems rather odd.

@eitsupi eitsupi marked this pull request as ready for review October 9, 2024 13:55
# Required for `cargo-msrv`, which doesn't yet support workspaces
metadata.msrv = "1.73.0"

rust-version = "1.73.0"
Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure if this is the ideal situation as I believe the MSRV is modified by the cli feature.
(All downstream crates that don't use the cli feature would also be affected by this)

Copy link
Member Author

Choose a reason for hiding this comment

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

In my opinion, it is not a good idea to manage the compiler itself and the CLI in one crate (much less make it a default feature).

Copy link
Member

Choose a reason for hiding this comment

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

On the narrow question of whether the rust-version here is correct — it's fine if the version constraint could be a bit lower. We currently test that 1.73.0 covers all features. So I think we're good?

Copy link
Member Author

Choose a reason for hiding this comment

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

My point is that it is the cli feature that pushes the MSRV to 1.73, if excluding the feature, MSRV is 1.70.
However, there is no way to express that in the current Cargo.toml, so the rust-version here must be 1.73 and downstream crates cannot use Rust 1.70.

This is just the current situation, but my point is that it may be difficult to combine those that should keep MSRV as low as possible for downstream considerations and those that should not into a single crate and manage them with feature flags.
I'm fine with it as it is for now, but ideally the CLI should be separated into a separate crate like prqlc-cli.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I agree that's a downside with having them integrated. I do think there are benefits to having them in a single crate — in particular cargo install prqlc, but we have gone back & forth, there are tradeoffs...

Copy link
Member Author

Choose a reason for hiding this comment

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

I do think there are benefits to having them in a single crate — in particular cargo install prqlc, but we have gone back & forth, there are tradeoffs...

I do not see how there is any problem with cargo install prqlc changing to cargo install prqlc-cli.
Or rename other than CLI to something like prqlc-core.

In any case, this is a separate issue that needs to be taken up.

Copy link
Member Author

Choose a reason for hiding this comment

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

# This isn't tested since `cargo msrv verify` doesn't support workspaces
# https://github.com/foresterre/cargo-msrv/issues/590
# But we can find the MSRV by `cargo msrv find`
rust-version = "1.77.2"
Copy link
Member

Choose a reason for hiding this comment

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

If no crates have rust-version.workspace = true, does this have any effect?

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean?
lutra has rust-version.workspace = true

Copy link
Member

Choose a reason for hiding this comment

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

OK I see. Possible we push that down to lutra, and leave this empty.

Hopefully we can have an MSRV for most of the workspace set here, and then lutra can have its own higher one. But possibly that won't work yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry, my understanding of MSRV was incorrect (foresterre/cargo-msrv#1023).

I will not work on it today so I will draft it and come back to it in a few days.

Copy link
Member

Choose a reason for hiding this comment

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

Ah great, thanks a lot for following up with that. I added a comment to the issue.

If that issue is resolved, I would vote to have an MSRV of something like 1.73.0 here, have most crates inherit it, and then Lutra has a different higher one.

@max-sixty
Copy link
Member

@max-sixty Do you remember why the MSRV checks were only available for nightly builds? To me this seems rather odd.

"nightly" is a bit of a misnomer — it's run on any big change, such as a dependency change. It's not run on every tiny change though, the change of something breaking is quite low, and would get picked up in the scheduled run.

@eitsupi eitsupi marked this pull request as draft October 10, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants