Open Aaron1011 opened 4 years ago
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...)
Should this be considered a duplicate of #75791?
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.