Skip to content

Commit 83d199e

Browse files
committed
fix async-fn test
1 parent 06af617 commit 83d199e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/run-pass/async-fn.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
// ignore-test FIXME ignored to let https://github.com/rust-lang/rust/pull/59119 land
21
#![feature(
32
async_await,
43
await_macro,
54
futures_api,
65
)]
76

87
use std::{future::Future, pin::Pin, task::Poll, ptr};
9-
use std::task::{Waker, RawWaker, RawWakerVTable};
8+
use std::task::{Waker, RawWaker, RawWakerVTable, Context};
109

1110
// See if we can run a basic `async fn`
1211
pub async fn foo(x: &u32, y: u32) -> u32 {
@@ -27,15 +26,16 @@ fn raw_waker_wake(_this: *const ()) {
2726
}
2827
fn raw_waker_drop(_this: *const ()) {}
2928

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+
);
3534

3635
fn main() {
3736
let x = 5;
3837
let mut fut = foo(&x, 7);
3938
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));
4141
}

0 commit comments

Comments
 (0)