1 // Creating a stack closure which references a box and then
2 // transferring ownership of the box before invoking the stack
3 // closure results in a crash.
7 fn twice(x: Box<usize>) -> usize {
11 fn invoke<F>(f: F) where F: FnOnce() -> usize {
16 let x : Box<usize> = Box::new(9);
17 let sq = || { *x * *x };
19 twice(x); //~ ERROR: cannot move out of