From 6b1f9f414b3551b06fb36f9c37f93e106bff9229 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Thu, 28 Jan 2021 14:39:23 +0100 Subject: [PATCH] runtime: update panic messages to include version (#3461) --- tokio/src/io/driver/mod.rs | 4 ++-- tokio/src/runtime/blocking/pool.rs | 4 ++-- tokio/src/runtime/handle.rs | 2 +- tokio/src/task/spawn.rs | 2 +- tokio/src/time/driver/handle.rs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tokio/src/io/driver/mod.rs b/tokio/src/io/driver/mod.rs index a1784dff4..c36859c1e 100644 --- a/tokio/src/io/driver/mod.rs +++ b/tokio/src/io/driver/mod.rs @@ -260,7 +260,7 @@ cfg_rt! { /// flag is not enabled. pub(super) fn current() -> Self { crate::runtime::context::io_handle() - .expect("there is no reactor running, must be called from the context of Tokio runtime") + .expect("there is no reactor running, must be called from the context of a Tokio 0.3.x runtime") } } } @@ -274,7 +274,7 @@ cfg_not_rt! { /// This function panics if there is no current reactor set, or if the `rt` /// feature flag is not enabled. pub(super) fn current() -> Self { - panic!("there is no reactor running, must be called from the context of Tokio runtime with `rt` enabled.") + panic!("there is no reactor running, must be called from the context of a Tokio 0.3.x runtime with `rt` enabled.") } } } diff --git a/tokio/src/runtime/blocking/pool.rs b/tokio/src/runtime/blocking/pool.rs index 9f98d898c..d2d368fe2 100644 --- a/tokio/src/runtime/blocking/pool.rs +++ b/tokio/src/runtime/blocking/pool.rs @@ -81,7 +81,7 @@ where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { - let rt = context::current().expect("not currently running on the Tokio runtime."); + let rt = context::current().expect("not currently running on a Tokio 0.3.x runtime."); rt.spawn_blocking(func) } @@ -91,7 +91,7 @@ where F: FnOnce() -> R + Send + 'static, R: Send + 'static, { - let rt = context::current().expect("not currently running on the Tokio runtime."); + let rt = context::current().expect("not currently running on a Tokio 0.3.x runtime."); let (task, _handle) = task::joinable(BlockingTask::new(func)); rt.blocking_spawner.spawn(task, &rt) diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index 138d13b25..77e316d19 100644 --- a/tokio/src/runtime/handle.rs +++ b/tokio/src/runtime/handle.rs @@ -97,7 +97,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.3.x runtime.") } /// Returns a Handle view over the currently running Runtime diff --git a/tokio/src/task/spawn.rs b/tokio/src/task/spawn.rs index a060852dc..1a5ebfb90 100644 --- a/tokio/src/task/spawn.rs +++ b/tokio/src/task/spawn.rs @@ -129,7 +129,7 @@ cfg_rt! { 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.3.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 bfc49fbe4..ac1106d1f 100644 --- a/tokio/src/time/driver/handle.rs +++ b/tokio/src/time/driver/handle.rs @@ -47,7 +47,7 @@ cfg_rt! { /// panicking. pub(crate) fn current() -> Self { crate::runtime::context::time_handle() - .expect("there is no timer running, must be called from the context of Tokio runtime") + .expect("there is no timer running, must be called from the context of a Tokio 0.3.x runtime") } } } @@ -71,7 +71,7 @@ cfg_not_rt! { /// lazy, and so outside executed inside the runtime successfuly without /// panicking. pub(crate) fn current() -> Self { - panic!("there is no timer running, must be called from the context of Tokio runtime or \ + panic!("there is no timer running, must be called from the context of a Tokio 0.3.x runtime or \ `rt` is not enabled") } }