]>
Commit | Line | Data |
---|---|---|
f2b60f7d | 1 | #![feature(unboxed_closures)] |
223e47cc | 2 | |
85aaf69f | 3 | fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f } |
1a4d82fc | 4 | fn do_it(x: &isize) { } |
223e47cc LB |
5 | |
6 | fn main() { | |
f2b60f7d | 7 | let x: Box<_> = Box::new(22); |
85aaf69f SL |
8 | let f = to_fn_once(move|| do_it(&*x)); |
9 | to_fn_once(move|| { | |
1a4d82fc JJ |
10 | f(); |
11 | f(); | |
12 | //~^ ERROR: use of moved value: `f` | |
13 | })() | |
223e47cc | 14 | } |