2015-01-08 21:54:35 +11:00
|
|
|
fn call_f<F:FnOnce() -> isize>(f: F) -> isize {
|
2013-07-17 07:19:43 -04:00
|
|
|
f()
|
|
|
|
}
|
|
|
|
|
2021-08-25 02:39:40 +02:00
|
|
|
|
|
|
|
|
2013-07-17 07:19:43 -04:00
|
|
|
fn main() {
|
2021-08-25 02:39:40 +02:00
|
|
|
let t: Box<_> = Box::new(3);
|
2013-07-17 07:19:43 -04:00
|
|
|
|
2014-11-26 08:12:18 -05:00
|
|
|
call_f(move|| { *t + 1 });
|
2019-04-22 08:40:08 +01:00
|
|
|
call_f(move|| { *t + 1 }); //~ ERROR use of moved value
|
2013-07-17 07:19:43 -04:00
|
|
|
}
|