summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs')
-rw-r--r--src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs
new file mode 100644
index 000000000..835a1f598
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs
@@ -0,0 +1,11 @@
+// Test that an unboxed closure that mutates a free variable will
+// cause borrow conflicts.
+
+
+
+fn main() {
+ let mut x = 0;
+ let f = || x += 1;
+ let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
+ f;
+}