diff --git a/tokio/src/runtime/task/list.rs b/tokio/src/runtime/task/list.rs index ca06d459c48..159c13e16e4 100644 --- a/tokio/src/runtime/task/list.rs +++ b/tokio/src/runtime/task/list.rs @@ -240,7 +240,7 @@ impl LocalOwnedTasks { self.with_inner(|inner| // safety: We just checked that the provided task is not in some // other linked list. - unsafe { inner.list.remove(task.header().into()) }) + unsafe { inner.list.remove(task.header_ptr()) }) } /// Asserts that the given task is owned by this LocalOwnedTasks and convert diff --git a/tokio/src/task/local.rs b/tokio/src/task/local.rs index 0ac28e67fc2..513671d097f 100644 --- a/tokio/src/task/local.rs +++ b/tokio/src/task/local.rs @@ -921,3 +921,22 @@ impl task::Schedule for Arc { } } } + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn local_current_thread_scheduler() { + let f = async { + LocalSet::new() + .run_until(async { + spawn_local(async {}).await.unwrap(); + }) + .await; + }; + crate::runtime::Builder::new_current_thread() + .build() + .expect("rt") + .block_on(f) + } +}