-
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
expected types of closure arguments are not inferred when coercing to a fn
#41755
Comments
Some brief mentoring instructions to fix this: The expected type for closure arguments are deduced using various bits of code in Please feel free to ping me on IRC or gitter with questions! (Or ask in #rustc) |
I'd like to work on this issue |
@z1mvader great! :) Let me know if my instructions suffice, or if you feel you need some more help. I do try to keep up with GH notifications, so you can ask questions here, but you'll definitely get a "snappier" response on IRC or gitter. |
OK, so, reading a bit more into that code, I see that it's use of In The "Poly" bit means that this function signature may have some higher-ranked regions (e.g., Now, this function is setup to return a So, the meaning of this return:
Therefore, I think we want to return something like |
…, r=nikomatsakis Fixed argument inference for closures when coercing into 'fn' This fixes rust-lang#41755. The tests `compile-fail/closure-no-fn.rs` and `compile-fail/issue-40000.rs` were modified. A new test `run-pass/closure_to_fn_coercion-expected-types.rs` was added r? @nikomatsakis
Type inference for the expected type of arguments doesn't work when coercing from a closure expression. For example, this code does not compile https://is.gd/FNoLWg (at least, not without an explicit
x: Vec<u32>
annotation):The text was updated successfully, but these errors were encountered: