-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Allow parameter types to be omitted from closure expressions #2093
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
Comments
I think this makes sense. Do we yet allow type annotations on block lambdas? If we did that then are both forms of anonymous function the same except that one can't |
We do allow type annotations in sugared closures. I believe the two forms are basically equivalent but for Ah, there is one other difference: you can have capture clauses on I was going to propose changing the syntax to amend that distinction, but I forgot about it. I'll make a second issue for that. |
Added the RFC label since this seems like a change requiring consensus. |
[**] I cannot find the reference for a meeting where removing the value-expression form was decided; the closest I have come to doing so is the weekly mtg from 2013-02-19, where Niko discussed allowing one to put the sigils on the front of the |
I've stumbled over an ignored test case which mentions this issue: |
@fhahn yeah just remove the test. This issue is no longer relevant due to language drift, basically. That test now compiles fine because of integer inference. |
* compile-fail/vec-add.rs is obsolete, there are no mutable vectors any more, rust-lang#2711 is closed * compile-fail/issue-1451.rs is obsolete, there are no more structural records, rust-lang#1451 is closed * compile-fail/issue-2074.rs is obsolete, an up to date test is in run-pass/nested-enum-same-names.rs, rust-lang#2074 is closed * compile-fail/omitted-arg-wrong-types.rs is obsolete, rust-lang#2093 is closed
* compile-fail/vec-add.rs is obsolete, there are no mutable vectors any more, rust-lang#2711 is closed * compile-fail/issue-1451.rs is obsolete, there are no more structural records, rust-lang#1451 is closed * compile-fail/issue-2074.rs is obsolete, an up to date test is in run-pass/nested-enum-same-names.rs, rust-lang#2074 is closed * compile-fail/omitted-arg-wrong-types.rs is obsolete, rust-lang#2093 is closed
We should allow you to write
fn&(x, y)
and infer the types forx
andy
just as we now infer the types for{|x, y|...}
. Similarly we should infer the return type too---not sure whether we should require something likefn&(x, y) -> { ... }
in that case, though.The text was updated successfully, but these errors were encountered: