File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 1
- // ignore-test FIXME ignored to let https://github.com/rust-lang/rust/pull/59119 land
2
1
#![ feature(
3
2
async_await,
4
3
await_macro,
5
4
futures_api,
6
5
) ]
7
6
8
7
use std:: { future:: Future , pin:: Pin , task:: Poll , ptr} ;
9
- use std:: task:: { Waker , RawWaker , RawWakerVTable } ;
8
+ use std:: task:: { Waker , RawWaker , RawWakerVTable , Context } ;
10
9
11
10
// See if we can run a basic `async fn`
12
11
pub async fn foo ( x : & u32 , y : u32 ) -> u32 {
@@ -27,15 +26,16 @@ fn raw_waker_wake(_this: *const ()) {
27
26
}
28
27
fn raw_waker_drop ( _this : * const ( ) ) { }
29
28
30
- static RAW_WAKER : RawWakerVTable = RawWakerVTable {
31
- clone : raw_waker_clone,
32
- wake : raw_waker_wake,
33
- drop : raw_waker_drop,
34
- } ;
29
+ static RAW_WAKER : RawWakerVTable = RawWakerVTable :: new (
30
+ raw_waker_clone,
31
+ raw_waker_wake,
32
+ raw_waker_drop,
33
+ ) ;
35
34
36
35
fn main ( ) {
37
36
let x = 5 ;
38
37
let mut fut = foo ( & x, 7 ) ;
39
38
let waker = unsafe { Waker :: new_unchecked ( RawWaker :: new ( ptr:: null ( ) , & RAW_WAKER ) ) } ;
40
- assert_eq ! ( unsafe { Pin :: new_unchecked( & mut fut) } . poll( & waker) , Poll :: Ready ( 31 ) ) ;
39
+ let mut context = Context :: from_waker ( & waker) ;
40
+ assert_eq ! ( unsafe { Pin :: new_unchecked( & mut fut) } . poll( & mut context) , Poll :: Ready ( 31 ) ) ;
41
41
}
You can’t perform that action at this time.
0 commit comments