about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/move-is-async-fn.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-01-25 17:43:35 +0000
committerMichael Goulet <michael@errs.io>2024-02-06 02:22:58 +0000
commit37184e86ea58bc90b8cd97f877d52ccce8ea02ab (patch)
treeccdae57eb3b8210c03d14b8e6e7a558c429a63bf /tests/ui/async-await/async-closures/move-is-async-fn.rs
parent881b6b5149e882434a8df80a829bcfde0a2e9d37 (diff)
downloadrust-37184e86ea58bc90b8cd97f877d52ccce8ea02ab.tar.gz
rust-37184e86ea58bc90b8cd97f877d52ccce8ea02ab.zip
Add some tests
Diffstat (limited to 'tests/ui/async-await/async-closures/move-is-async-fn.rs')
-rw-r--r--tests/ui/async-await/async-closures/move-is-async-fn.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/async-await/async-closures/move-is-async-fn.rs b/tests/ui/async-await/async-closures/move-is-async-fn.rs
new file mode 100644
index 00000000000..943c0629541
--- /dev/null
+++ b/tests/ui/async-await/async-closures/move-is-async-fn.rs
@@ -0,0 +1,21 @@
+// aux-build:block-on.rs
+// edition:2021
+// build-pass
+
+#![feature(async_closure)]
+
+extern crate block_on;
+
+fn main() {
+    block_on::block_on(async {
+        let s = String::from("hello, world");
+        let c = async move || {
+            println!("{s}");
+        };
+        c().await;
+        c().await;
+
+        fn is_static<T: 'static>(_: T) {}
+        is_static(c);
+    });
+}