From c62b17a5c8483b5bc998f4f36a4a2e39e6df77b6 Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Sat, 2 Oct 2021 07:23:24 +0100 Subject: [PATCH] Fixed bug when polling async futures (#77) We expect first value returned via coroutine.yield() to be a special Pending type. But instead we checked second value. --- src/thread.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thread.rs b/src/thread.rs index 7ff2138..7178215 100644 --- a/src/thread.rs +++ b/src/thread.rs @@ -344,7 +344,7 @@ where #[inline(always)] fn is_poll_pending(val: &MultiValue) -> bool { match val.iter().enumerate().last() { - Some((1, Value::LightUserData(ud))) => { + Some((0, Value::LightUserData(ud))) => { ud.0 == &ASYNC_POLL_PENDING as *const u8 as *mut c_void } _ => false,