Do #[repr(Rust)] unions have internal padding? · Issue #354 · rust-lang/unsafe-code-guidelines (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@alercah

Description

@alercah

Forked from #156. The question is specifically whether a union type has non-tail padding when every variant has padding at a particular byte, meaning that the padding could be clobbered. @RalfJung says no, because he would like unions to simply be [byte; N]. Nobody has made a case for any other answer, as far as I'm aware. But making a separate issue since it's a separate question about the #[repr(Rust)] ABI and what we want to guarantee.