You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)();
^~~~~~
The text was updated successfully, but these errors were encountered:
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:
Error:
The text was updated successfully, but these errors were encountered: