From 8b0b3365f2c85f6a31b5cd2c92b7714b6ef4f97f Mon Sep 17 00:00:00 2001 From: sharnoff <29154784+sharnoff@users.noreply.github.com> Date: Sun, 4 Dec 2022 18:57:20 -0800 Subject: [PATCH] Add note about current-thread + Handle::block_on There's already an existing warning about this combo in the documentation for `Handle::block_on`. This commit adds a summarized version in `Runtime::handle`. --- tokio/src/runtime/runtime.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tokio/src/runtime/runtime.rs b/tokio/src/runtime/runtime.rs index 3d4fd67884d..9ede0a7b0b5 100644 --- a/tokio/src/runtime/runtime.rs +++ b/tokio/src/runtime/runtime.rs @@ -138,6 +138,9 @@ impl Runtime { /// The returned handle can be used to spawn tasks that run on this runtime, and can /// be cloned to allow moving the `Handle` to other threads. /// + /// Calling [`Handle::block_on`] on a handle to a `current_thread` runtime is error-prone. + /// Refer to the documentation of [`Handle::block_on`] for more. + /// /// # Examples /// /// ```