rust/src/test/ui/borrowck/borrowck-move-by-capture.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

12 lines
296 B
Rust
Raw Normal View History

#![feature(unboxed_closures)]
fn to_fn_mut<A,F:FnMut<A>>(f: F) -> F { f }
fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f }
2015-01-08 02:53:58 +00:00
pub fn main() {
let bar: Box<_> = Box::new(3);
let _g = to_fn_mut(|| {
let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of
});
}