Skip to content

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

tediou5
Copy link
Contributor

@tediou5 tediou5 commented May 14, 2025

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):

  1. ) -> Option<impl Future<Output = Option<Piece>> + use<FarmIndex>> {
  2. https://github.com/tediou5/subspace/blob/c65631e55bd8076f0b75ad790f657ab79dff8a89/crates/subspace-farmer/src/single_disk_farm/farming.rs#L131-L143

Code contributor checklist:

Copy link
Contributor

@vedhavyas vedhavyas left a 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>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member

@teor2345 teor2345 left a 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!

  1. Please run clippy before pushing changes.

  2. 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.

  1. Here's how editions can be inherited:
    https://doc.rust-lang.org/cargo/reference/workspaces.html#the-package-table

  2. 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>> {
Copy link
Member

@teor2345 teor2345 May 14, 2025

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};
Copy link
Member

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.

Copy link
Contributor Author

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.

@tediou5 tediou5 force-pushed the chore/update-rust-toolchain-and-edition branch from c65631e to 511d7ca Compare May 16, 2025 10:52
@tediou5 tediou5 requested review from teor2345 and vedhavyas May 16, 2025 10:53
@tediou5
Copy link
Contributor Author

tediou5 commented May 16, 2025

Following the review suggestions, I’ve split it into different commits.

@tediou5 tediou5 force-pushed the chore/update-rust-toolchain-and-edition branch from 30d3075 to f8fb5f0 Compare May 19, 2025 03:01
@tediou5 tediou5 force-pushed the chore/update-rust-toolchain-and-edition branch from f8fb5f0 to b9e8ad0 Compare May 21, 2025 03:22
@tediou5
Copy link
Contributor Author

tediou5 commented May 21, 2025

Just rebased main

@vedhavyas
Copy link
Contributor

@tediou5 can you resolve conflicts please ?

@tediou5
Copy link
Contributor Author

tediou5 commented May 27, 2025

@tediou5 can you resolve conflicts please ?

Sure, I'll resolve it later.

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