[rust-dev] RFC: Future-proof for unboxed closures

Niko Matsakis niko at alum.mit.edu
Mon Jan 27 03:03:51 PST 2014


On Sat, Jan 25, 2014 at 07:07:32PM +0100, Gábor Lehel wrote:
> If you wanted to pass an unboxed closure without indirection though, like
> `fn foo<T: Fn<U, R>>(x: T)`, then you would have to explicitly dereference
> the closure, i.e. `foo(*|u| r)` (which might be OK).

Why would you want to do that? There is no advantage to doing so; the ABI
will almost certainly reintroduce indirection anyhow.

> The basic problem is that there's a zoo of closure types:
> http://glaebhoerl.tumblr.com/rust_closure_types (I will be referring to
> things from this in the following!)

No time to write a long response here just now, but this is a very
nice writeup, thanks.



Niko


More information about the Rust-dev mailing list