]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_error_codes/src/error_codes/E0588.md
New upstream version 1.68.2+dfsg1
[rustc.git] / compiler / rustc_error_codes / src / error_codes / E0588.md
CommitLineData
60c5eb7d
XL
1A type with `packed` representation hint has a field with `align`
2representation hint.
3
4Erroneous code example:
5
6```compile_fail,E0588
7#[repr(align(16))]
8struct Aligned(i32);
9
10#[repr(packed)] // error!
11struct Packed(Aligned);
12```
13
f25598a0 14Just like you cannot have both `align` and `packed` representation hints on the
60c5eb7d
XL
15same type, a `packed` type cannot contain another type with the `align`
16representation hint. However, you can do the opposite:
17
18```
19#[repr(packed)]
20struct Packed(i32);
21
22#[repr(align(16))] // ok!
23struct Aligned(Packed);
24```