We could have a || expression expand to &F or &mut F where F : Fn() (FnMut, etc), and not just F. This would make it easier to write code that accepted boxed closures:
fn foo(x: &mut FnMut()) { ... }
foo(|| ...)
whereas today it is required to write:
This seems like a pretty small delta and might go a long way towards improving ergonomic impact of the new closure design.
We could have a
||expression expand to&For&mut FwhereF : Fn()(FnMut, etc), and not justF. This would make it easier to write code that accepted boxed closures:whereas today it is required to write:
This seems like a pretty small delta and might go a long way towards improving ergonomic impact of the new closure design.