-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Infer async closure signature from old-style two-part Fn + Future bounds
- Loading branch information
1 parent
59a4f02
commit f4f678f
Showing
2 changed files
with
121 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
tests/ui/async-await/async-closures/signature-inference-from-two-part-bound.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}) | ||
} |