summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/access-mode-in-closures.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/access-mode-in-closures.rs')
-rw-r--r--tests/ui/borrowck/access-mode-in-closures.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/borrowck/access-mode-in-closures.rs b/tests/ui/borrowck/access-mode-in-closures.rs
new file mode 100644
index 000000000..9bd90e70a
--- /dev/null
+++ b/tests/ui/borrowck/access-mode-in-closures.rs
@@ -0,0 +1,10 @@
+struct S(Vec<isize>);
+
+fn unpack<F>(_unpack: F) where F: FnOnce(&S) -> Vec<isize> {}
+
+fn main() {
+ let _foo = unpack(|s| {
+ // Test that `s` is moved here.
+ match *s { S(v) => v } //~ ERROR cannot move out
+ });
+}