-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
mislead type ascribed to collection in a for loop diagnostic error #97163
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.Category: This is a bug.D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.D-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.Diagnostics: A diagnostic that is giving misleading or incorrect information.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code (playground):
I expected to see this happen: I expect an error, but I expect the diagnostic to report types that corespond to all the expressions involved.
Instead, this happened: Part of the error diagostic claims that
&mut maphas typeOption<(&(char, char), &mut (char, char))>This is very confusing. In a simple case this I am certain that
&mut mapdoes not have that type, and it just ends up distracting me from the rest of the message (which does try to indicate what is wrong. But in a more complex case, where its not obvious that the compiler is misleading me, I end up wasting my time trying to figure out whymapis getting a value of the wrong type here.Herei is the specific diagnostic output I am seeing: