librustc: handle repr on structs, require it for ffi, unify with packed
As of RFC 18, struct layout is undefined. Opting into a C-compatible struct layout is now down with #[repr(C)]. For consistency, specifying a packed layout is now also down with #[repr(packed)]. Both can be specified. To fix errors caused by this, just add #[repr(C)] to the structs, and change #[packed] to #[repr(packed)] Closes #14309 [breaking-change]
This commit is contained in:
parent
54bd9e6323
commit
6e8ff99958
27 changed files with 210 additions and 118 deletions
|
@ -87,7 +87,7 @@ struct PaddedStruct {
|
|||
e: i16
|
||||
}
|
||||
|
||||
#[packed]
|
||||
#[repr(packed)]
|
||||
struct PackedStruct {
|
||||
a: i16,
|
||||
b: AnEnum,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue