svd2rust icon indicating copy to clipboard operation
svd2rust copied to clipboard

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

Open Plaba opened this issue 7 months ago • 7 comments

tested against RA4M1 SVD

tested on rustc 1.86.0 svd2rust 0.36.1

Plaba avatar May 14 '25 04:05 Plaba

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

Emilgardis avatar May 14 '25 06:05 Emilgardis

but I can't find it anymore

https://github.com/rust-embedded/svd2rust/pull/891

1.82.0 Released on: 17 October, 2024

burrbull avatar May 14 '25 12:05 burrbull

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

burrbull avatar Jun 08 '25 14:06 burrbull

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

Edition 2024 needs rust 1.85.

jannic avatar Jun 17 '25 18:06 jannic

@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

therealprof avatar Jun 17 '25 18:06 therealprof

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?

burrbull avatar Jun 17 '25 18:06 burrbull

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

BartMassey avatar Jun 17 '25 18:06 BartMassey