Inconsistent handling of #[derive]
on invalid targets
#78331
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
The following code:
produces the following error
However, applying
#[derive]
to alet
statement 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.The text was updated successfully, but these errors were encountered: