2022-07-30 05:37:48 +00:00
|
|
|
#![feature(unboxed_closures, tuple_trait)]
|
2015-01-07 18:53:58 -08:00
|
|
|
|
2022-07-30 05:37:48 +00:00
|
|
|
fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f }
|
2015-01-08 21:54:35 +11:00
|
|
|
fn do_it(x: &isize) { }
|
2014-11-26 08:12:18 -05:00
|
|
|
|
2014-04-08 16:59:18 -07:00
|
|
|
fn main() {
|
2022-07-07 04:36:10 +02:00
|
|
|
let x: Box<_> = Box::new(22);
|
2015-02-03 11:32:26 -05:00
|
|
|
let f = to_fn_once(move|| do_it(&*x));
|
|
|
|
to_fn_once(move|| {
|
2014-04-08 16:59:18 -07:00
|
|
|
f();
|
|
|
|
f();
|
|
|
|
//~^ ERROR: use of moved value: `f`
|
|
|
|
})()
|
|
|
|
}
|