Closed
Description
fn bar() {
for i in range(0, 10u) {
println!("{}", i)
}
}
fn callit(f: ||) { f() }
fn main() {
// callit(bar);
let f = bar;
callit(f)
}
prints
<anon>:12:12: 12:13 error: cannot coerce non-statically resolved bare fn
<anon>:12 callit(f)
^
We can do better here, e.g. by suggesting to the user that they make the closure construction explicit via eta-expansion, i.e. writing callit(||f())
(or callit(|x|g(x))
, etc).