-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Using variant on self type with path Self::Variant causes subpar diagnostic #52118
Copy link
Copy link
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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 lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.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.
The snippet below fails to compile with the following messages of each
enumvariant:The solution is to replace
Self::Initwith explicit typeState::Init. But the issues are:Selfinstead of the explicit type)no variant named "Init" found for type "State" in the current scopeis misleadingnote: did you mean "variant::Init"?is also a little misleading. A phrase likenote: replace "Self::Init" with "State::Init"is much clearerAnd finally:
Self::allowed insideimpl MyEnumblocks?