mislead type ascribed to collection in a for
loop diagnostic error
#97163
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-bug
Category: This is a bug.
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
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 map
has typeOption<(&(char, char), &mut (char, char))>
This is very confusing. In a simple case this I am certain that
&mut map
does 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 whymap
is getting a value of the wrong type here.Herei is the specific diagnostic output I am seeing:
The text was updated successfully, but these errors were encountered: