2022-07-30 00:37:48 -05:00
|
|
|
#![feature(unboxed_closures, tuple_trait)]
|
2015-02-03 10:32:26 -06:00
|
|
|
|
2022-07-30 00:37:48 -05:00
|
|
|
fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f }
|
2015-01-07 20:53:58 -06:00
|
|
|
|
2014-03-06 11:55:35 -06:00
|
|
|
fn main() {
|
|
|
|
let r = {
|
2021-08-24 19:39:40 -05:00
|
|
|
let x: Box<_> = Box::new(42);
|
2019-04-22 02:40:08 -05:00
|
|
|
let f = to_fn_once(move|| &x); //~ ERROR cannot return reference to local data `x`
|
2014-03-06 11:55:35 -06:00
|
|
|
f()
|
|
|
|
};
|
|
|
|
|
|
|
|
drop(r);
|
|
|
|
}
|