2022-07-30 05:37:48 +00:00
|
|
|
#![feature(unboxed_closures, tuple_trait)]
|
2015-02-03 11:32:26 -05: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-07 18:53:58 -08:00
|
|
|
|
2014-03-06 09:55:35 -08:00
|
|
|
fn main() {
|
|
|
|
let r = {
|
2021-08-25 02:39:40 +02:00
|
|
|
let x: Box<_> = Box::new(42);
|
2019-04-22 08:40:08 +01:00
|
|
|
let f = to_fn_once(move|| &x); //~ ERROR cannot return reference to local data `x`
|
2014-03-06 09:55:35 -08:00
|
|
|
f()
|
|
|
|
};
|
|
|
|
|
|
|
|
drop(r);
|
|
|
|
}
|