summaryrefslogtreecommitdiffstats
path: root/src/test/ui/moves/issue-75904-move-closure-loop.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/moves/issue-75904-move-closure-loop.rs')
-rw-r--r--src/test/ui/moves/issue-75904-move-closure-loop.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/ui/moves/issue-75904-move-closure-loop.rs b/src/test/ui/moves/issue-75904-move-closure-loop.rs
new file mode 100644
index 000000000..6641a0376
--- /dev/null
+++ b/src/test/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;
+ };
+ }
+}