rust-embedded / svd2rust

Generate Rust register maps (`struct`s) from SVD files
Apache License 2.0
697 stars 150 forks source link

Vector type isn't repr(C) #755

Closed thejpster closed 11 months ago

thejpster commented 11 months ago

Someone asked me:

Why isn't the Vector union in the PAC repr(C)

and I didn't know the answer. As we rely on the alignment and representation, it feels like it should be?

adamgreig commented 11 months ago

Yep, I believe it should be. Since both the types inside the union have the same repr as the corresponding C types and the same size and alignment as each other (on our targets anyway), there's very little scope for rustc to do anything wrong with the default union repr, but nevertheless it should be. I've opened #756 to fix.

burrbull commented 11 months ago

Fixed by #756