Closed
Description
Building on the changes in #39361, it'd be nice to suggest when the user ought to annotate a closure return type, as I think many users are not even aware this is possible. Example:
fn main() {
let _v = || [];
}
I'd like to suggest something like :
error[E0101]: cannot determine a type for this expression: unconstrained type
--> <anon>:2:17
|
2 | let _v = || [];
| -- ^^ cannot resolve type of expression
|
consider annotating the return type of this closure like so `|| -> TYPE { [] }`
Not sure the best way to phrase that yet. =)
cc @cengizio -- interested in following up on this? I can help mentor it.
cc @estebank @jonathandturner -- any thoughts on how to phrase the suggestion?