Skip to content

Various attributes and extern "C" must be marked "unsafe" to compile generated code - #933

Closed
Plaba wants to merge 1 commit into
rust-embedded:masterfrom
Plaba:master
Closed

Plaba wants to merge 1 commit into
rust-embedded:masterfrom
Plaba:master

Conversation

@Plaba

@Plaba Plaba commented May 14, 2025 •

Copy link
Copy Markdown

tested against RA4M1 SVD

tested on rustc 1.86.0 svd2rust 0.36.1

@Plaba
Plaba requested a review from a team as a code owner May 14, 2025 04:21
@Emilgardis

Copy link
Copy Markdown
Member

This is due to edition change, use 2021 edition in Cargo.toml to resolve. I remember an issue where we discussed how to solve this but I can't find it anymore

@burrbull

Copy link
Copy Markdown
Member

but I can't find it anymore

#891

1.82.0 Released on: 17 October, 2024

@burrbull

burrbull commented Jun 8, 2025

Copy link
Copy Markdown
Member

@therealprof What do you think? Should we bump rust to 1.82 and fix this or stay on edition 2021?

@jannic

jannic commented Jun 17, 2025

Copy link
Copy Markdown
Member

Should we bump rust to 1.82 and fix this or stay on edition 2021

Edition 2024 needs rust 1.85.

@therealprof

Copy link
Copy Markdown
Contributor

@therealprof What do you think? Should we bump rust to 1.82 and fix this or stay on edition 2021?

As discussed in our weekly meeting just now, we see very little upside in bumping to edition 2024 at this time and some major downsides, like not being able to build the generated PACs with Ferrocene for the time being. Since crates can be build with different editions there doesn't seem to be an obvious reason to make the jump now.

It would be good to know if we missed something important. @Plaba

@burrbull

burrbull commented Jun 17, 2025 •

Copy link
Copy Markdown
Member

Ok. Another suggestion. Support 2 rust versions.

What do you think about support by default last stable version of Rust?
But also add --rust-1.76 option (or just --msrv) which allows to generate code acceptable by old compilers?

@BartMassey

Copy link
Copy Markdown
Member

@burrbull We did discuss adding a --edition=2024 flag to svd2rust (with some earlier Rust version as default); also adding cfg(edition="2024") flags to the generated code. The consensus was that things are working OK as-is as far as we know, so we chose not to put in the work yet.

@maya-qorsa

Copy link
Copy Markdown

Since the last update on this PR, Debian trixie has been released, which uses Rust 1.85. Would there be any interest now in updating everything to 1.85 / edition 2024? Other projects like RfL use Debian Stable as their MSRV, but I'm not sure whether wg-embedded has different priorities.

@BartMassey

Copy link
Copy Markdown
Member

@maya-qorsa Great question. Please file this as an issue referencing this PR and we'll discuss it at an upcoming REWG meeting hopefully.

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.

7 participants