-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Bad suggestions when trying to initialize an enum as a struct. #93322
Copy link
Copy link
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.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.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.Diagnostics: A structured suggestion resulting in incorrect code.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Occurs in nightly-2022-01-26
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=2eec42713e64ef9243a12589aece967c
The output is a mess of false suggestions, I managed to hit an error that looked very similar to this while refactoring:
At a minimum we should detect that these suggestions are invalid and not suggest them:
However maybe we should instead suggest that the user try to properly use Foo as an enum?