rust/src/test/ui/span/issue-11925.rs

14 lines
258 B
Rust
Raw Normal View History

#![feature(box_syntax, unboxed_closures)]
fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
2015-01-07 20:53:58 -06:00
fn main() {
let r = {
let x: Box<_> = box 42;
2017-11-20 06:13:27 -06:00
let f = to_fn_once(move|| &x); //~ ERROR does not live long enough
f()
};
drop(r);
}