about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/move-out-of-ref.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/async-closures/move-out-of-ref.rs')
-rw-r--r--tests/ui/async-await/async-closures/move-out-of-ref.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/async-await/async-closures/move-out-of-ref.rs b/tests/ui/async-await/async-closures/move-out-of-ref.rs
new file mode 100644
index 00000000000..a05447232f6
--- /dev/null
+++ b/tests/ui/async-await/async-closures/move-out-of-ref.rs
@@ -0,0 +1,16 @@
+//@ compile-flags: -Zvalidate-mir
+//@ edition: 2021
+
+#![feature(async_closure)]
+
+// NOT copy.
+struct Ty;
+
+fn hello(x: &Ty) {
+    let c = async || {
+        *x;
+        //~^ ERROR cannot move out of `*x` which is behind a shared reference
+    };
+}
+
+fn main() {}