diff --git a/tokio/src/runtime/scheduler/mod.rs b/tokio/src/runtime/scheduler/mod.rs index 6548564e214..c7fa17260c6 100644 --- a/tokio/src/runtime/scheduler/mod.rs +++ b/tokio/src/runtime/scheduler/mod.rs @@ -27,7 +27,8 @@ cfg_rt_multi_thread! { use crate::runtime::driver; -use super::task::Schedule; +#[cfg(feature = "rt")] +use crate::runtime::task::Schedule; #[derive(Debug, Clone)] pub(crate) enum Handle { @@ -130,7 +131,7 @@ cfg_rt! { Handle::MultiThreadAlt(h) => multi_thread_alt::Handle::spawn(h, future, id), } } - + #[cfg(feature = "rt")] pub(crate) fn release(&self, task: &Task) -> Option { match self { @@ -144,6 +145,7 @@ cfg_rt! { } } + #[cfg(feature = "rt")] pub(crate) fn schedule(&self, task: Notified) { match self { @@ -156,7 +158,7 @@ cfg_rt! { Handle::MultiThreadAlt(h) => h.schedule(task), } } - + #[cfg(feature = "rt")] pub(crate) fn yield_now(&self, task: Notified) { match self { Handle::CurrentThread(h) => h.yield_now(task), @@ -168,7 +170,7 @@ cfg_rt! { Handle::MultiThreadAlt(h) => h.yield_now(task), } } - + pub(crate) fn shutdown(&self) { match *self { Handle::CurrentThread(_) => {}, diff --git a/tokio/src/runtime/task/core.rs b/tokio/src/runtime/task/core.rs index de0c47bdb4f..45315c07926 100644 --- a/tokio/src/runtime/task/core.rs +++ b/tokio/src/runtime/task/core.rs @@ -431,9 +431,9 @@ impl Header { /// /// The generic type S must be set to the correct scheduler type for this /// task. - pub(super) unsafe fn get_scheduler(me: NonNull
) -> NonNull { + pub(super) unsafe fn get_scheduler(me: NonNull
) -> NonNull> { let offset = me.as_ref().vtable.scheduler_offset; - let scheduler = me.as_ptr().cast::().add(offset).cast::(); + let scheduler = me.as_ptr().cast::().add(offset).cast::>(); NonNull::new_unchecked(scheduler) } diff --git a/tokio/src/runtime/task/raw.rs b/tokio/src/runtime/task/raw.rs index 76ee1f323ea..f62f4abcf91 100644 --- a/tokio/src/runtime/task/raw.rs +++ b/tokio/src/runtime/task/raw.rs @@ -279,7 +279,7 @@ unsafe fn poll(ptr: NonNull
) { unsafe fn schedule(ptr: NonNull
) { use crate::runtime::task::{Notified, Task}; - let scheduler = Header::get_scheduler::>(ptr).as_ref(); + let scheduler = Header::get_scheduler::(ptr).as_ref(); let notify = Notified(Task::from_raw(ptr.cast())); match scheduler { Some(scheduler) => scheduler.schedule(notify),