-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Error output for mismatched types with a 1-ary tuple could hint to add a missing comma #86100
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-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 lintsD-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.
Type mismatch errors with a 1-tuple and a single value wrapped in parentheses could be improved.
Playground link with a few other examples
The current output is:
Ideally the E0308 mismatched types error could have a hint when the type of the value and the type of the element in the 1-tuple match that is something along the lines of
I believe that this could improve newcomers' experience by highlighting the difference in the types, especially when the type is inferred like in some of the other playground examples, and explaining the syntax to create a tuple.
Inspired by #86019
@rustbot label +D-papercut +D-newcomer-roadblock