rust/tests/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
347 B
Rust
Raw Normal View History

2022-07-30 00:37:48 -05:00
#![feature(unboxed_closures, tuple_trait)]
2022-07-30 00:37:48 -05:00
fn to_fn_mut<A:std::marker::Tuple,F:FnMut<A>>(f: F) -> F { f }
fn to_fn_once<A:std::marker::Tuple,F:FnOnce<A>>(f: F) -> F { f }
2015-01-07 20:53:58 -06: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
});
}