File tree 2 files changed +40
-0
lines changed
tests/ui/async-await/async-closures
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ // aux-build:block-on.rs
2
+ // edition:2021
3
+ // build-pass
4
+
5
+ #![ feature( async_closure) ]
6
+
7
+ use std:: future:: Future ;
8
+
9
+ extern crate block_on;
10
+
11
+ struct NoCopy ;
12
+
13
+ fn main ( ) {
14
+ block_on:: block_on ( async {
15
+ async fn call_once < F : Future > ( x : impl Fn ( & ' static str ) -> F ) -> F :: Output {
16
+ x ( "hello, world" ) . await
17
+ }
18
+ call_once ( async |x : & ' static str | {
19
+ println ! ( "hello, {x}" ) ;
20
+ } ) . await
21
+ } ) ;
22
+ }
Original file line number Diff line number Diff line change
1
+ // aux-build:block-on.rs
2
+ // edition:2021
3
+ // build-pass
4
+
5
+ // check that `&{async-closure}` implements `AsyncFn`.
6
+
7
+ #![ feature( async_closure) ]
8
+
9
+ extern crate block_on;
10
+
11
+ struct NoCopy ;
12
+
13
+ fn main ( ) {
14
+ block_on:: block_on ( async {
15
+ async fn call_once ( x : impl async Fn ( ) ) { x ( ) . await }
16
+ call_once ( & async || { } ) . await
17
+ } ) ;
18
+ }
You can’t perform that action at this time.
0 commit comments