1 A `#[repr(..)]` attribute was placed on an unsupported item.
3 Examples of erroneous code:
13 struct Foo {bar: bool, baz: bool}
21 * The `#[repr(C)]` attribute can only be placed on structs and enums.
22 * The `#[repr(packed)]` and `#[repr(simd)]` attributes only work on structs.
23 * The `#[repr(u8)]`, `#[repr(i16)]`, etc attributes only work on enums.
25 These attributes do not work on typedefs, since typedefs are just aliases.
27 Representations like `#[repr(u8)]`, `#[repr(i64)]` are for selecting the
28 discriminant size for enums with no data fields on any of the variants, e.g.
29 `enum Color {Red, Blue, Green}`, effectively setting the size of the enum to
30 the size of the provided type. Such an enum can be cast to a value of the same
31 type as well. In short, `#[repr(u8)]` makes the enum behave like an integer
32 with a constrained set of allowed values.
34 Only field-less enums can be cast to numerical primitives, so this attribute
35 will not apply to structs.
37 `#[repr(packed)]` reduces padding to make the struct size smaller. The
38 representation of enums isn't strictly defined in Rust, and this attribute
41 `#[repr(simd)]` will give a struct consisting of a homogeneous series of machine
42 types (i.e., `u8`, `i32`, etc) a representation that permits vectorization via
43 SIMD. This doesn't make much sense for enums since they don't consist of a