refactor: migrate to Rust 2024 edition#145
Merged
Merged
Conversation
Bind async results to explicit let variables before match expressions to ensure temporaries are dropped before MutexGuard and other locals with custom Drop impls, preventing drop order changes in Rust 2024.
Rename local variables named 'gen' to 'pcie_gen_value', 'generation', or 'generator' since 'gen' becomes a reserved keyword in Rust 2024. Use r#gen for external crate field access (amdgpu link.gen).
- Change macro expr fragment specifiers to expr_2021 for forward compat - Convert if-let-else chains to match expressions (Rust 2024 requirement) - Remove unnecessary ref in if-let patterns - Add unsafe block inside unsafe fn body (Rust 2024 requirement)
Update edition from 2021 to 2024 and apply all resulting changes: - Collapse nested if-let blocks using Rust 2024 let-chain syntax - Reorder imports per Rust 2024 formatting rules - Fix indentation in let-chain expressions
Remove explicit ref mut binding modifiers in patterns that already implicitly borrow through &mut references (Rust 2024 requirement). Also add tmp.pb to .gitignore.
Member
Author
Implementation Review SummaryIntent
Findings AddressedNo issues found requiring fixes. The implementation is correct and complete. Detailed AnalysisDROP ORDER FIXES (HIGH RISK) -- CORRECT
GEN KEYWORD RENAMES (MEDIUM RISK) -- CORRECT AND COMPLETE
MACRO FRAGMENT SPECIFIERS (LOW RISK) -- CORRECT
REF REMOVAL AND IF-LET CONVERSIONS (LOW RISK) -- CORRECT
EDITION FLIP -- CORRECT
FORMATTING -- CORRECT
MISCELLANEOUS
Remaining ItemsNone. All requirements from issue #144 are addressed. Verification
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate the codebase from Rust 2021 edition to Rust 2024 edition (rustc 1.94.1).
Changes by phase:
Phase 1: Fix temporary value drop order (HIGH RISK)
letvariables beforematchintpu_grpc.rsandnetwork/client.rsto prevent drop order changes forMutexGuardand other types with customDropimplementations.Phase 2: Rename
genkeyword (MEDIUM RISK)genvariables togenerator,pcie_gen_value, orgenerationsincegenis reserved in Rust 2024.r#genfor external crate field access (amdgpucrate'slink.gen).Phase 3: Auto-fixable changes (LOW RISK)
exprfragment specifiers toexpr_2021for forward compatibility.if let...elsechains tomatchexpressions.refinif letpatterns.unsafeblock insideunsafe fnbody.Phase 4: Edition flip and cleanup
Cargo.tomledition from"2021"to"2024".if letchain syntax (collapsible_if).ref mutin implicit borrowing patterns.Closes #144
Test plan
cargo checkpasses with no warningscargo clippy -- -D warningspasses cleanlycargo fmt -- --checkpassescargo testpasses (all 19 tests pass)