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 rust-version field #490

Merged
merged 2 commits into from
Nov 28, 2023
Merged

Conversation

Sh3Rm4n
Copy link
Contributor

@Sh3Rm4n Sh3Rm4n commented Aug 26, 2023

I've noticed that this project does not use the rust-version field yet, while maintaining a MSRV policy. Add this field to make
this policy machine-readable and leverage nicer cargo feedback in case of an older rust version.

@Sh3Rm4n Sh3Rm4n requested a review from a team as a code owner August 26, 2023 07:24
@Dirbaio
Copy link
Member

Dirbaio commented Aug 26, 2023

rust-version actively forbids using the crate in lower version. I'm not sure if this is something we want to do.

The 1.60 MSRV is due to the use of dep: in Cargo.toml. Only embedded-hal-bus and embedded-io-adapters actually use it, so in theory other crates like embedded-hal could work on 1.59 or older. So, adding rust-version is overly strict.

Options:

  • Set rust-version to 1.60 anyway even if it's too strict. Perhaps it's fine, 1.60 is almost 1.5 years old by now.
  • Track MSRV for each crate individually, set rust-version to that.
  • Keep tracking a single MSRV for the entire repo (i.e 1.60) but not add rust-version. So crates that don't actually need 1.60 still work on older Rusts, but it's not officially supported by the embedded-hal project.

I'm not sure what's the best solution here.

@Sh3Rm4n
Copy link
Contributor Author

Sh3Rm4n commented Aug 28, 2023

rust-version actively forbids using the crate in lower version. I'm not sure if this is something we want to do.

Yeah, that is a valid concern. However, --ignore-rust-verison exist to be able to opt out of this behavior.

The 1.60 MSRV is due to the use of dep: in Cargo.toml. Only embedded-hal-bus and embedded-io-adapters actually use it, so in theory other crates like embedded-hal could work on 1.59 or older. So, adding rust-version is overly strict.

I'm fine with making it more granular per crate.

Options:
* [...]
* Track MSRV for each crate individually, set rust-version to that.

Well, I'm unsurprisingly in favor of this approach. It is machine-readable, generates clear error messages instead of some issues, which seem totally unrelated for the user, if they did not check their installed version yet, and it can be better checked by CI. The README approach is not as visible to most users and has to be verified manually if the MSRV needs changing. IMO rust-version makes maintaining the MSRV guarantees easier.

But this is not up to me, as I'm not a maintainer of embedded-hal, so I'm fine if you close this PR and keep using the current approach. :)

@rursprung
Copy link
Contributor

FYI: if you want to identify the MSRV for each crate (to set it now initially) you can use cargo-msrv to do that. i think with that it's then also no hassle to update it for the individual crates when needed

@Sh3Rm4n Sh3Rm4n force-pushed the chore/rust-version branch from cd667e6 to 689408b Compare October 21, 2023 08:13
@Sh3Rm4n
Copy link
Contributor Author

Sh3Rm4n commented Oct 21, 2023

I've reduced the MSRV for all crates, which do not use dep: to 1.56, which is the 2021 edition release.

@rursprung
Copy link
Contributor

i think this should land before v1.0 is released - it'd help with cleaner error messages in the future when the MSRV for a crate is increased. the rust/crates teams also encourages setting this field (see various posts in their forums & issues)

@Dirbaio
Copy link
Member

Dirbaio commented Nov 26, 2023

Doing option 2 ("Track MSRV for each crate individually, set rust-version to that.") sounds good to me then. We can discuss it next weekly meeting and merge if there's no objections.

Copy link
Member

@Dirbaio Dirbaio left a comment

Choose a reason for hiding this comment

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

Discussed in today's meeting, conclusion is track MSRV per crate separately.

Async stuff will have to be rust-version = 1.75.

I'll add CI to test the different MSRVs in a follow-up PR.

@Dirbaio Dirbaio added this pull request to the merge queue Nov 28, 2023
Merged via the queue into rust-embedded:master with commit c10ddae Nov 28, 2023
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 this pull request may close these issues.

3 participants