Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Aaron1011 opened this issue Jun 19, 2020 · 2 comments
Open
Assignees
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.

Comments

@Aaron1011
Copy link
Member

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.

@Aaron1011 Aaron1011 added A-diagnostics Area: Messages for errors, warnings, and lints A-lifetimes Area: Lifetimes / regions T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. D-confusing Diagnostics: Confusing error or lint that should be reworked. labels Jun 19, 2020
@ijackson
Copy link
Contributor

Also, even if you know it must be a lifetime mismatch you have to intuit (or puzzle) what is wrong (or you can sprinkle random lifetime annotations until it compiles...)

@camelid
Copy link
Member

camelid commented Jan 12, 2021

Should this be considered a duplicate of #75791?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants