summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/access-mode-in-closures.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/borrowck/access-mode-in-closures.rs')
-rw-r--r--src/test/ui/borrowck/access-mode-in-closures.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/access-mode-in-closures.rs b/src/test/ui/borrowck/access-mode-in-closures.rs
new file mode 100644
index 000000000..9bd90e70a
--- /dev/null
+++ b/src/test/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
+ });
+}