about summary refs log tree commit diff
path: root/tests/ui/moves/issue-75904-move-closure-loop.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/moves/issue-75904-move-closure-loop.rs')
-rw-r--r--tests/ui/moves/issue-75904-move-closure-loop.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/moves/issue-75904-move-closure-loop.rs b/tests/ui/moves/issue-75904-move-closure-loop.rs
new file mode 100644
index 00000000000..6641a0376c6
--- /dev/null
+++ b/tests/ui/moves/issue-75904-move-closure-loop.rs
@@ -0,0 +1,15 @@
+// Regression test for issue #75904
+// Tests that we point at an expression
+// that required the upvar to be moved, rather than just borrowed.
+
+struct NotCopy;
+
+fn main() {
+    let mut a = NotCopy;
+    loop {
+        || { //~ ERROR use of moved value
+            &mut a;
+            a;
+        };
+    }
+}