about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-07-07 22:39:30 -0400
committerMichael Goulet <michael@errs.io>2024-07-08 12:56:54 -0400
commitf4f678f27e84254cc89fd53ae20e467a254982de (patch)
tree0ae92534a676d2b12b8adfabaff5e259836a8fb7 /tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs
parent59a4f02f836f74c4cf08f47d76c9f6069a2f8276 (diff)
downloadrust-f4f678f27e84254cc89fd53ae20e467a254982de.tar.gz
rust-f4f678f27e84254cc89fd53ae20e467a254982de.zip
Infer async closure signature from old-style two-part Fn + Future bounds
Diffstat (limited to 'tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs')
-rw-r--r--tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs b/tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs
new file mode 100644
index 00000000000..0e2d1ef1208
--- /dev/null
+++ b/tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs
@@ -0,0 +1,27 @@
+//@ edition: 2021
+//@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
+
+#![feature(async_closure)]
+
+use std::future::Future;
+use std::any::Any;
+
+struct Struct;
+impl Struct {
+    fn method(&self) {}
+}
+
+fn fake_async_closure<F, Fut>(_: F)
+where
+    F: Fn(Struct) -> Fut,
+    Fut: Future<Output = ()>,
+{}
+
+fn main() {
+    fake_async_closure(async |s| {
+        s.method();
+    })
+}