-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Vague error message when using generics #71924
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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 lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.Diagnostics: Confusing error or lint; hard to understand for new users.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.
I received the following error while working on an Amethyst project;
After scratching my head for a while and searching the Amethyst Discord, and finally StackOverflow, I realized I was having a brainfart and the type I was using was a generic and I wasn't fully defining it. I had been having some trouble getting an import to work successfully, so I was unsure if the type was even successfully being added to my namespace in the first place, which left me completely confused as to how to interpret this error. Was the compiler telling me 'TileMap' is not a type..??
This error does not seem in line with the level of explicitness of most of the first-pass compiler errors, and does not contain any resolution suggestions. At least one past issue exists about this particular type of error and several stackoverflow threads exist asking, essentially, 'What does this error mean?' (with successful resolutions of the form, 'That's a generic type with missing type parameters') which seems like a good indicator that the error could be more helpful and explicit. (e.g. 'This generic type is expecting _ type parameters but only found _')
This issue has been assigned to @Patryk27 via this comment.