-
Notifications
You must be signed in to change notification settings - Fork 254
chore: update rust toolchain, migrate to 2024 edition #3535
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
base: main
Are you sure you want to change the base?
chore: update rust toolchain, migrate to 2024 edition #3535
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be ideal if you could derive the edition from the workspace Cargo.toml.
Rest looks good
@@ -134,7 +134,8 @@ where | |||
) -> Result< | |||
Vec<( | |||
SectorIndex, | |||
impl ProvableSolutions<Item = Result<Solution<PublicKey>, ProvingError>> + 'a, | |||
impl ProvableSolutions<Item = Result<Solution<PublicKey>, ProvingError>> | |||
+ use<'a, PosTable, Plot>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more on the use
bound: https://blog.rust-lang.org/2024/09/05/impl-trait-capture-rules/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!
-
Please run
clippy
before pushing changes. -
This PR is one big commit, which makes it harder to review.
To split it into different commits, you could do something like:
- one commit which inherits the 2021 edition manually (or mostly automatically using search and replace)
- another commit which switches to the 2024 edition automatically, with the exact command used to do that copied into the commit message
- a commit for
cargo clippy fix --all
- a commit for any manual clippy fixes that are needed
- any other required manual changes, in separate commits for each type of change
- a commit for rustfmt (with the command in the commit message)
Having separate commits is not a blocker for me, but I might not have time to review all the commits in detail. Putting the commands in each commit makes review easier, because I can run the command and make sure it produces the same output.
Would be ideal if you could derive the edition from the workspace Cargo.toml.
-
Here's how editions can be inherited:
https://doc.rust-lang.org/cargo/reference/workspaces.html#the-package-table -
There's also an unnecessary (but technically correct)
use<>
I'd like to fix up.
@@ -61,7 +61,7 @@ where | |||
pub fn read_piece( | |||
&self, | |||
piece_index: PieceIndex, | |||
) -> Option<impl Future<Output = Option<Piece>> + 'static> { | |||
) -> Option<impl Future<Output = Option<Piece>> + use<FarmIndex>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I can see, the use<FarmIndex>
is only required for debugging, so it can be removed by doing:
let farm_index = usize::from(piece_details.farm_index);
near the start of the function.
This change doesn't need to be in this PR.
use crate::block_tree::{prune_receipt, BlockTreeNode}; | ||
use crate::block_tree::{BlockTreeNode, prune_receipt}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like rustfmt
changes the type/function ordering in use
between editions. I wonder if this would be better done in a separate PR?
reorder_imports = false
might keep things the way they are in this PR.
https://github.com/rust-lang/rustfmt/blob/master/Configurations.md#reorder_imports
This is not a blocker for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this as part of the version migration, so I’ve moved it into a separate commit. I hope that makes it easier for you to review.
c65631e
to
511d7ca
Compare
Following the review suggestions, I’ve split it into different commits. |
30d3075
to
f8fb5f0
Compare
…tures runtime-benchmarks,cuda --fix --all -- -D warnings
…eatures rocm --fix
f8fb5f0
to
b9e8ad0
Compare
Just rebased main |
@tediou5 can you resolve conflicts please ? |
Sure, I'll resolve it later. |
let_chains is already stable.
duration_constructors_lite was forked from duration_constructors and contains only the non-controversial parts(rust-lang/rust#120301).
Most of the changes are simply moves triggered by the updated fmt rules.
The only difference comes from the updated lifetime-capture rules in RPIT(https://doc.rust-lang.org/edition-guide/rust-2024/rpit-lifetime-capture.html):
subspace/crates/subspace-farmer/src/farm/plotted_pieces.rs
Line 64 in c65631e
Code contributor checklist: