Skip to content

Commit a43706c

Browse files
committed
Allow #[repr(packed)] inside #[repr(align)]
1 parent ae4f345 commit a43706c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

text/0000-repr-align.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ will always be respected. If a pointer to a non-aligned structure exists and is
7070
used then it is considered unsafe behavior. Local variables, objects in arrays,
7171
statics, etc, will all respect the custom alignment specified for a type.
7272

73-
For now, it will be illegal to mix `#[repr(align)]` and `#[repr(packed)]` in
74-
structs. Specifically, both attributes cannot be applied on the same struct, and
75-
a `#[repr(packed)]` struct cannot transitively contain another struct with
76-
`#[repr(align)]` or vice versa. The behavior of MSVC and gcc differ in how these
77-
properties interact, and for now we'll just yield an error while we get
78-
experience with the two attributes.
73+
For now, it will be illegal for any `#[repr(packed)]` struct to transitively
74+
contain a struct with `#[repr(align)]`. Specifically, both attributes cannot be
75+
applied on the same struct, and a `#[repr(packed)]` struct cannot transitively
76+
contain another struct with `#[repr(align)]`. The flip side, including a
77+
`#[repr(packed)]` structure inside of a `#[repr(align)]` one will be allowed.
78+
The behavior of MSVC and gcc differ in how these properties interact, and for
79+
now we'll just yield an error while we get experience with the two attributes.
7980

8081
Some examples of `#[repr(align)]` are:
8182

0 commit comments

Comments
 (0)