Update roles rust edition to 2021#1818
Conversation
|
Side note: My initial attempt was to update to edition 2024, which I successfully did. However, when running the CI locally, I was blocked by the MSRV, which doesn’t support https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 |
c07d6da to
ecd0c72
Compare
Shourya742
left a comment
There was a problem hiding this comment.
Thanks for this! Could you run cargo fix --edition once and check if the lock file changes? Also, it'd be great if you can take a quick look to see if any new features in the edition might actually help us. For the role crates, MSRV doesn’t really matter since they’re just applications built on top of our protocol layer. But for the protocol crates, we do need to stick to an MSRV mainly to guarantee that downstream users can compile them with any stable compiler starting from 1.75. That also means we shouldn't use any syntax or features that aren’t supported in 1.75.
if a dependency is attached to some MSRV, doesn't that mean the crate that depends on it is also bound to that MSRV? in other words: what happens if I try to build |
@Shourya742, thanks for the review! I’ve completed the migration using I also took a quick look at the changes in the 2021 edition and didn’t notice anything particularly useful for our case. The primary reason for opening this PR is that I noticed some mismatched editions between roles, with some on 2018 and others on 2021. This is more of a housekeeping thing. |
@plebhash, just a practical response: $ pwd && cargo +1.74.0 build
/home/lucasbalieiro/Projects/stratum/roles/pool
error: package `config v0.14.1` cannot be built because it requires rustc 1.75.0 or newer, while the currently active rustc version is 1.74.0
Either upgrade to rustc 1.75.0 or newer, or use
cargo update config@0.14.1 --precise ver
where `ver` is the latest version of `config` supporting rustc 1.74.0As you can see, it throws an error about the |
ecd0c72 to
88d7a3c
Compare
Yes, the Rust version used to build these top-level crates should be greater than or equal to the highest MSRV among their dependencies. So, the role crates should be built with rustc >= 1.75.0. Any version above 1.75 will work, and you're free to use features introduced in those versions even if they wouldn't compile on 1.75. What I meant is: code that compiles with 1.75 will also compile with 1.80, but the reverse isn't necessarily true features from 1.80 may not be compatible with the 1.75 compiler. |
88d7a3c to
b0357f6
Compare
|
LGTM, but I'm curious to know: have you tried to bump also protocol crates' editions during your testing? |
Yes, I ran Would you like me to include this in the current PR? |
|
Why not? |
protocols edition bumped in: upgrade protocols to rust edition 2021 |
|
We still have |
@GitGab19, the
I added the commits for |
|
Can you elaborate more on the toolchain? Which toolchain is used there? |
Apologies 😅, while writing up the explanation, I realized that the $ cat utils/buffer/fuzz/rust-toolchain.toml
[toolchain]
channel = "nightly-2020-04-06" #here is the toolchain for the buffer-fuzzI've just updated the buffer crate accordingly. |
closes #1666 ;
Updates all roles crates to edition 2021 where needed;