-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Inconsistent handling of #[derive] on invalid targets #78331
Copy link
Copy link
Closed
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
The following code:
produces the following error
However, applying
#[derive]to aletstatement just gives an "unused attribute" warning:A
#[derive]attribute doesn't make any more sense on a statement than it does on an item. I think we should handle these two cases in the same way.There's been a move towards forbidding attributes on targets that don't make sense: #77015. Unless anyone objects, I think we should consistently forbid
#[derive]on all invalid targets.