- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.
Description
Given the following code: https://gist.github.com/cbe5d4fb00ed34650d2873725eefbc67
pub enum Test {
    #[default]
    First,
    Second,
}The current output is:
error: cannot find attribute `default` in this scope
 --> src/lib.rs:2:7
  |
2 |     #[default]
  |       ^^^^^^^
Ideally the output should suggest adding a #[derive(Default)] attribute to the enum. Bonus points if it detects an existing derive attribute and merely adds to the list, rather than adding a new attribute.
Note that this depends on the derive_default_enum feature, which will soon be stabilised as of the FCP in #87517.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.