Skip to content

FAQ on "How do I return a closure from a function?" no longer correct because impl Fn #51289

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

Closed
FranklinChen opened this issue Jun 2, 2018 · 2 comments
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools

Comments

@FranklinChen
Copy link
Contributor

https://www.rust-lang.org/en-US/faq.html#how-do-i-return-a-closure-from-a-function is no longer correct because now it is possible to return a closure without boxing it thanks to returning impl Fn.

@Mark-Simulacrum Mark-Simulacrum added the A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools label Jun 2, 2018
@est31
Copy link
Member

est31 commented Jun 2, 2018

It should probably also mention that if the closure doesn't capture anything, you can return a function pointer now, as non capturing closures coerce to function pointers.

@pietroalbini
Copy link
Member

The FAQ is managed on the rust-lang/rust-www repo. Can you open an issue there? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools
Projects
None yet
Development

No branches or pull requests

4 participants