[nll] improve the "fully elaborated type" case in region errors #52533
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-NLL
Area: Non-lexical lifetimes (NLL)
NLL-diagnostics
Working towards the "diagnostic parity" goal
Consider this example:
Here, we are returning
b
from the closure but we ought to be returninga
. We get this error message, which could be much clearer:There are a number of problems here, but the part I wanted to focus on in this issue is the message "lifetime
'1
appears in this argument".This message occurs when we fail, for whatever reason, to identify part of the type that we can highlight. For example, if we compare against the case where we have given type annotations in the closure, we can see that in that case we do better:
The goal of this issue is to do better in this case where no type annotations are available. We've been discussing this on an internals thread and there have been a number of helpful suggestions. I think for the purposes of this issue the wording isn't that important, I'm mostly interested in producing the "fully elaborated type" print out. So let's go with something simple like this as our goal:
The text was updated successfully, but these errors were encountered: