Solving coherence problems with trait impls for closures: provide a `Closure` wrapper in libcore and make closure expressions evaluate to that type

I like this idea, I have run into this exact issue a number of times, and this looks like a nice fix.

On the issue of function pointers, we could have then be the same type as Closure<_>, and just have it spelled the same way as today. This way it just works without breaking backwards compatibility. (Basically, make the current spelling a type alias for the more general feature). We don't have to worry about fn items becayse those are unnamable, so we could change those over to Closure<_> as well.

1 Like