about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/kind-due-to-arg-with-box-wrap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/async-await/async-closures/kind-due-to-arg-with-box-wrap.rs')
-rw-r--r--tests/ui/async-await/async-closures/kind-due-to-arg-with-box-wrap.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/async-await/async-closures/kind-due-to-arg-with-box-wrap.rs b/tests/ui/async-await/async-closures/kind-due-to-arg-with-box-wrap.rs
new file mode 100644
index 00000000000..650fb10d94b
--- /dev/null
+++ b/tests/ui/async-await/async-closures/kind-due-to-arg-with-box-wrap.rs
@@ -0,0 +1,22 @@
+//@ edition: 2024
+
+// Regression test for <https://github.com/rust-lang/rust/issues/140292>.
+
+struct Test;
+
+impl Test {
+    async fn an_async_fn(&mut self) {
+        todo!()
+    }
+
+    pub async fn uses_takes_asyncfn(&mut self) {
+        takes_asyncfn(Box::new(async || self.an_async_fn().await));
+        //~^ ERROR expected a closure that implements the `AsyncFn` trait, but this closure only implements `AsyncFnMut`
+    }
+}
+
+async fn takes_asyncfn(_: impl AsyncFn()) {
+    todo!()
+}
+
+fn main() {}