Closed
Description
When calling a closure behind a shared reference the error reported is simply "closure invocation in a &
reference". When I first encountered this I had no idea what the problem was or how to fix it. Simply mentioning that closures behind a reference can only be called via &mut
would help.
Test case:
fn main() {
let foo: &|| = &|| ();
(*foo)();
}
Error:
test.rs:3:5: 3:11 error: closure invocation in a `&` reference
test.rs:3 (*foo)();
^~~~~~