-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
#[repr()] is allowed where it shouldn't #129606
Copy link
Copy link
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-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
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-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
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code:
I expected to see this happen: #[repr] doesn't make sense on other than struct/enum/union, so it shouldn't be permitted. Every case except the
structshould be an error. Not sure if that one ought to be legal either, but I guess the current warning is enough there.Instead, this happened: Plenty of unused attribute warnings, but it compiles.
Meta
Tested on playground, both
1.80.1and1.82.0-nightly (2024-08-24 f167efad2f51088d8618).