Fall back to more verbose error when 'expected' and 'found' are the same #73521
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In some cases (#71723, #73520), we emit an error of the form 'expected A, found A', where the 'expected' and 'found' cases are character-for-character identical.
We could make these messages much less confusing by detecting the case where the formatted 'expected' and 'found' values are identical, and fallback to explicitly printing lifetimes when this happens. While this could result in more verbose error messages, it should help point users in the right direction. Currently, there's absolutely no indication that these issues result from a lifetime mismatch - users must either learn this from experience, or read the compiler internals.
The text was updated successfully, but these errors were encountered: