Skip to content

Update to Rust edition 2024 #299

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 10 commits into
base: master
Choose a base branch
from
Open

Update to Rust edition 2024 #299

wants to merge 10 commits into from

Conversation

romancardenas
Copy link
Contributor

No description provided.

@romancardenas romancardenas requested a review from a team as a code owner June 13, 2025 20:16
@romancardenas
Copy link
Contributor Author

Looks like we need to update all the crates at once... I will keep doing this when I have time

@romancardenas romancardenas changed the title Adapt riscv-semihosting to edition 2024 Update to Rust edition 2024 Jun 14, 2025
@romancardenas romancardenas force-pushed the edition-2024 branch 3 times, most recently from df2e6e1 to 50b9557 Compare June 16, 2025 15:56
@romancardenas
Copy link
Contributor Author

@rmsyn I think it is done. The only test failing is a nightly clippy lint that is still unstable.

Copy link
Contributor

@rmsyn rmsyn left a comment

Choose a reason for hiding this comment

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

@rmsyn I think it is done. The only test failing is a nightly clippy lint that is still unstable.

Looks like I can't comment on the offending code, because you didn't make edits to it. Here is my suggestion:

    // riscv-rt/macros/src/lib.rs:91
    #[cfg(feature = "u-boot")]
    if let Some(argument) = f.sig.inputs.get(0) {
        if let Some(message) = check_argument_type(argument, "c_int") {
            return message;
        }
    }
    // instead do
    #[cfg(feature = "u-boot")]
    if let Some(message) = f.sig.inputs.get(0).and_then(|argument| check_argument_type(argument, "c_int")) {
        return message;
    }

    // same as above
    #[cfg(feature = "u-boot")]
    if let Some(argument) = f.sig.inputs.get(1) {
        if let Some(message) = check_argument_type(argument, "*const *const c_char") {
            return message;
        }
    }
    // should be
    #[cfg(feature = "u-boot")]
    if let Some(message) = f.sig.inputs.get(1).and_then(|argument| check_argument_type(argument, "*const *const c_char")) {
            return message;
    }

Edit: here is a branch with formatted changes: https://github.com/rust-embedded/riscv/compare/edition-2024...rmsyn:riscv:edition-2024-lint-fixes?expand=1

@rmsyn
Copy link
Contributor

rmsyn commented Jun 17, 2025

@romancardenas fixed the lints in #301

@romancardenas
Copy link
Contributor Author

Please, point to this branch in this PR and I will merge it. I think we should leave this PR updated and ready to merge as soon as we decide to go with edition 2024

@rmsyn
Copy link
Contributor

rmsyn commented Jun 17, 2025

as soon as we decide to go with edition 2024

After the discussion in today's meeting about updating svd2rust to edition 2024, I think the same arguments apply to the riscv crates, right? Since if riscv crates go to edition 2024, that would force svd2rust to update as well.

Linking the svd2rust discussion for tracking purposes: rust-embedded/svd2rust#933 (comment)

@romancardenas
Copy link
Contributor Author

Yep, we can leave this PR open and updated to upgrade to edition 2024 whenever the WG decides it is worth it.

@romancardenas romancardenas added the do not merge this code should not be merged to master label Jun 18, 2025
Copy link

This PR is being prevented from merging because it presents one of the blocking labels: work in progress, do not merge.

@romancardenas romancardenas linked an issue Jun 19, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do not merge this code should not be merged to master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port to Rust edition 2024
2 participants