-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
detect when unconstrained type parameters could be resolved by a closure return type #40014
Comments
I'd probably use a suggestion with a span, rather than trying to fit it. Or... maybe something like:
|
Hello @nikomatsakis I'll be working on this. Thanks for reporting and mentoring! |
@jonathandturner so actually I'm not sure that the main
|
Interesting, how about if the ^^ was the suggestion?
|
I take it back, I think yours is better since the error should be about inference. |
@jonathandturner it does feel like saying the exact same thing (as i wrote it) is suboptimal... |
How about?
|
Maybe this? Or do we try to avoid "labels" that assume you have read the "main" message?
|
Generally, yeah. I did a quick survey when we were doing the error message redesign, and most people saw the label first. So I just assume people don't see the main message now, to be on the safe side. |
I am mildly worried that putting the tip 'in line' will also run into trouble because it will tend to wrap. |
It could go in attached note... |
#63507 (addressing #63506) will cause this case to suggest turning it into a boxed fn trait:
Suggesting annotating the closure itself would probably be better. Edit: changed to be
|
…ntril When needing type annotations in local bindings, account for impl Trait and closures Fix rust-lang#46680, fix rust-lang#63504, fix rust-lang#63506, fix rust-lang#40014, cc rust-lang#63502.
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:
I'd like to suggest something like :
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?
The text was updated successfully, but these errors were encountered: