summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/borrowck-move-by-capture.rs
blob: f26edef17f34963fd7fed5f2638d4ad323dfd407 (plain)
1
2
3
4
5
6
7
8
9
10
11
#![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 }

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
    });
}