-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-alignArea: alignment control (`repr(align(N))` and so on)Area: alignment control (`repr(align(N))` and so on)A-enumArea: Enums (discriminated unions, or more generally ADTs (algebraic data types))Area: Enums (discriminated unions, or more generally ADTs (algebraic data types))A-layoutArea: Memory layout of typesArea: Memory layout of typesA-reprArea: the `#[repr(stuff)]` attributeArea: the `#[repr(stuff)]` attributeC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Description
I tried this code:
enum Never {}
#[repr(align(4))]
enum Thing { Variant(Never) }
fn main() {
assert_eq!(1, align_of::<Thing>());
}I expected the alignment of Thing to be 4, as per the repr attribute, so the assertion should fail. Instead, the program runs without errors.
Meta
Reproducible on the playground with version 1.93.0-nightly (2025-11-22 94b49fd998d6723e0a92)
Metadata
Metadata
Assignees
Labels
A-alignArea: alignment control (`repr(align(N))` and so on)Area: alignment control (`repr(align(N))` and so on)A-enumArea: Enums (discriminated unions, or more generally ADTs (algebraic data types))Area: Enums (discriminated unions, or more generally ADTs (algebraic data types))A-layoutArea: Memory layout of typesArea: Memory layout of typesA-reprArea: the `#[repr(stuff)]` attributeArea: the `#[repr(stuff)]` attributeC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team