From a43706c7610a1498db5385a87df5361a14d9b273 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 11 May 2016 10:43:04 -0700 Subject: [PATCH] Allow #[repr(packed)] inside #[repr(align)] --- text/0000-repr-align.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/text/0000-repr-align.md b/text/0000-repr-align.md index efaba0b9185..843d43719c7 100644 --- a/text/0000-repr-align.md +++ b/text/0000-repr-align.md @@ -70,12 +70,13 @@ will always be respected. If a pointer to a non-aligned structure exists and is used then it is considered unsafe behavior. Local variables, objects in arrays, statics, etc, will all respect the custom alignment specified for a type. -For now, it will be illegal to mix `#[repr(align)]` and `#[repr(packed)]` in -structs. Specifically, both attributes cannot be applied on the same struct, and -a `#[repr(packed)]` struct cannot transitively contain another struct with -`#[repr(align)]` or vice versa. The behavior of MSVC and gcc differ in how these -properties interact, and for now we'll just yield an error while we get -experience with the two attributes. +For now, it will be illegal for any `#[repr(packed)]` struct to transitively +contain a struct with `#[repr(align)]`. Specifically, both attributes cannot be +applied on the same struct, and a `#[repr(packed)]` struct cannot transitively +contain another struct with `#[repr(align)]`. The flip side, including a +`#[repr(packed)]` structure inside of a `#[repr(align)]` one will be allowed. +The behavior of MSVC and gcc differ in how these properties interact, and for +now we'll just yield an error while we get experience with the two attributes. Some examples of `#[repr(align)]` are: