diff --git a/tokio/src/task/local.rs b/tokio/src/task/local.rs index 8a401fe03b0..6d0adf31c0c 100644 --- a/tokio/src/task/local.rs +++ b/tokio/src/task/local.rs @@ -345,8 +345,9 @@ impl Schedule for Scheduler { } } - fn release(&self, _: Task) { - unreachable!("tasks should only be completed locally") + fn release(&self, task: Task) { + // This will be called when dropping the local runtime. + self.pending_drop.push(task); } fn release_local(&self, task: &Task) {