diff options
Diffstat (limited to 'tests/ui/borrowck/borrowck-move-by-capture.rs')
-rw-r--r-- | tests/ui/borrowck/borrowck-move-by-capture.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-move-by-capture.rs b/tests/ui/borrowck/borrowck-move-by-capture.rs new file mode 100644 index 000000000..6f0eb1870 --- /dev/null +++ b/tests/ui/borrowck/borrowck-move-by-capture.rs @@ -0,0 +1,11 @@ +#![feature(unboxed_closures, tuple_trait)] + +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 } + +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 + }); +} |