From 86ffabe2af69f2440be26d153fd692689c9947fb Mon Sep 17 00:00:00 2001 From: sharnoff <29154784+sharnoff@users.noreply.github.com> Date: Mon, 5 Dec 2022 06:14:05 +0000 Subject: [PATCH] docs: add note about current-thread + Handle::block_on (#5264) 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 /// /// ```