File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 33// edition:2018
44// aux-build:arc_wake.rs
55
6- #![ feature( async_await) ]
6+ #![ feature( async_await, async_closure ) ]
77
88extern crate arc_wake;
99
@@ -70,6 +70,13 @@ fn async_nonmove_block(x: u8) -> impl Future<Output = u8> {
7070 }
7171}
7272
73+ fn async_closure ( x : u8 ) -> impl Future < Output = u8 > {
74+ ( async move |x : u8 | -> u8 {
75+ wake_and_yield_once ( ) . await ;
76+ x
77+ } ) ( x)
78+ }
79+
7380async fn async_fn ( x : u8 ) -> u8 {
7481 wake_and_yield_once ( ) . await ;
7582 x
@@ -173,6 +180,7 @@ fn main() {
173180 test ! {
174181 async_block,
175182 async_nonmove_block,
183+ async_closure,
176184 async_fn,
177185 generic_async_fn,
178186 async_fn_with_internal_borrow,
Original file line number Diff line number Diff line change @@ -134,11 +134,15 @@ trait Bar {
134134}
135135
136136impl Foo {
137- async fn async_method ( x : u8 ) -> u8 {
137+ async fn async_assoc_item ( x : u8 ) -> u8 {
138138 unsafe {
139139 await ! ( unsafe_async_fn( x) )
140140 }
141141 }
142+
143+ async unsafe fn async_unsafe_assoc_item ( x : u8 ) -> u8 {
144+ await ! ( unsafe_async_fn( x) )
145+ }
142146}
143147
144148fn test_future_yields_once_then_returns < F , Fut > ( f : F )
@@ -180,12 +184,17 @@ fn main() {
180184 async_fn,
181185 generic_async_fn,
182186 async_fn_with_internal_borrow,
183- Foo :: async_method ,
187+ Foo :: async_assoc_item ,
184188 |x| {
185189 async move {
186190 unsafe { await !( unsafe_async_fn( x) ) }
187191 }
188192 } ,
193+ |x| {
194+ async move {
195+ unsafe { await !( Foo :: async_unsafe_assoc_item( x) ) }
196+ }
197+ } ,
189198 }
190199 test_with_borrow ! {
191200 async_block_with_borrow_named_lifetime,
You can’t perform that action at this time.
0 commit comments