diff options
Diffstat (limited to 'tests/ui/borrowck/borrowck-move-moved-value-into-closure.rs')
-rw-r--r-- | tests/ui/borrowck/borrowck-move-moved-value-into-closure.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/borrowck/borrowck-move-moved-value-into-closure.rs b/tests/ui/borrowck/borrowck-move-moved-value-into-closure.rs new file mode 100644 index 000000000..72e7b5a71 --- /dev/null +++ b/tests/ui/borrowck/borrowck-move-moved-value-into-closure.rs @@ -0,0 +1,12 @@ +fn call_f<F:FnOnce() -> isize>(f: F) -> isize { + f() +} + + + +fn main() { + let t: Box<_> = Box::new(3); + + call_f(move|| { *t + 1 }); + call_f(move|| { *t + 1 }); //~ ERROR use of moved value +} |