From 312c981e3f18c4ec900d77a951c7b8ef770c172e Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Thu, 28 Jan 2021 14:39:15 +0100 Subject: [PATCH] runtime: update panic messages to include version (#3460) --- tokio/src/io/driver/mod.rs | 5 +++-- tokio/src/runtime/handle.rs | 2 +- tokio/src/sync/broadcast.rs | 1 - tokio/src/task/spawn.rs | 2 +- tokio/src/time/driver/handle.rs | 5 +++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/tokio/src/io/driver/mod.rs b/tokio/src/io/driver/mod.rs index d8d17f8873b..3809cf40a02 100644 --- a/tokio/src/io/driver/mod.rs +++ b/tokio/src/io/driver/mod.rs @@ -200,8 +200,9 @@ impl Handle { /// /// This function panics if there is no current reactor set. pub(super) fn current() -> Self { - context::io_handle() - .expect("there is no reactor running, must be called from the context of Tokio runtime") + context::io_handle().expect( + "there is no reactor running, must be called from the context of a Tokio 0.2.x runtime", + ) } /// Forces a reactor blocked in a call to `turn` to wakeup, or otherwise diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index 0716a7fadca..92c08d617b2 100644 --- a/tokio/src/runtime/handle.rs +++ b/tokio/src/runtime/handle.rs @@ -115,7 +115,7 @@ impl Handle { /// # } /// ``` pub fn current() -> Self { - context::current().expect("not currently running on the Tokio runtime.") + context::current().expect("not currently running on a Tokio 0.2.x runtime.") } /// Returns a Handle view over the currently running Runtime diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs index a64774ecb0b..8fcb2b4b0fc 100644 --- a/tokio/src/sync/broadcast.rs +++ b/tokio/src/sync/broadcast.rs @@ -957,7 +957,6 @@ where #[cfg(feature = "stream")] #[doc(hidden)] -#[deprecated(since = "0.2.21", note = "use `into_stream()`")] impl crate::stream::Stream for Receiver where T: Clone, diff --git a/tokio/src/task/spawn.rs b/tokio/src/task/spawn.rs index d6e771184f2..014a01952be 100644 --- a/tokio/src/task/spawn.rs +++ b/tokio/src/task/spawn.rs @@ -128,7 +128,7 @@ doc_rt_core! { T::Output: Send + 'static, { let spawn_handle = runtime::context::spawn_handle() - .expect("must be called from the context of Tokio runtime configured with either `basic_scheduler` or `threaded_scheduler`"); + .expect("must be called from the context of a Tokio 0.2.x runtime configured with either `basic_scheduler` or `threaded_scheduler`"); let task = crate::util::trace::task(task, "task"); spawn_handle.spawn(task) } diff --git a/tokio/src/time/driver/handle.rs b/tokio/src/time/driver/handle.rs index 38b1761c8e4..4526304cda4 100644 --- a/tokio/src/time/driver/handle.rs +++ b/tokio/src/time/driver/handle.rs @@ -21,8 +21,9 @@ impl Handle { /// /// This function panics if there is no current timer set. pub(crate) fn current() -> Self { - context::time_handle() - .expect("there is no timer running, must be called from the context of Tokio runtime") + context::time_handle().expect( + "there is no timer running, must be called from the context of a Tokio 0.2.x runtime", + ) } /// Tries to return a strong ref to the inner