Skip to content

Fall back to more verbose error when 'expected' and 'found' are the same #73521

Open
@Aaron1011

Description

@Aaron1011

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.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-lifetimesArea: Lifetimes / regionsD-confusingDiagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions