Closed
Description
RFC 1358 introduced #[repr(align(x))]
on structs (and unions). It mentions:
Custom alignment can only be specified on struct declarations for now. Specifying a different alignment on perhaps enum or type definitions should be a backwards-compatible extension.
It would be a nice convenience to allow this for enums, especially when they are part of a public API.
#[repr(align(x))]
enum Foo {
// ...
}
would be equivalent to using AlignX<Foo>
everywhere:
#[repr(align(x))]
struct AlignX<T>(T);
enum Foo {
// ...
}