Skip to content

Instantly share code, notes, and snippets.

@DaGenix
Created July 1, 2013 05:35
Show Gist options
  • Save DaGenix/5898568 to your computer and use it in GitHub Desktop.
Save DaGenix/5898568 to your computer and use it in GitHub Desktop.
call twice thing
fn call(f: &fn()) {
f();
}
fn call_twice(f: &fn()) {
call(f);
call(f);
}
fn main() {
fn test() { }
call_twice(test);
}
@DaGenix
Copy link
Author

DaGenix commented Jul 1, 2013

This results in:

moved-fn-issue.rs:9:6: 9:7 error: use of moved value: f
moved-fn-issue.rs:9 call(f);
^
moved-fn-issue.rs:8:6: 8:7 note: f moved here because it has type &fn<no-bounds>(), which is moved by default (use copy to override)
moved-fn-issue.rs:8 call(f);
^
error: aborting due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment