From c8a990eda470fb9b66b1cd9cd384010d1019673a Mon Sep 17 00:00:00 2001 From: Sean McArthur Date: Fri, 28 Dec 2018 12:09:35 -0800 Subject: [PATCH] tokio-reactor: deprecates `Handle::current()` (#805) The side effects of calling `Handle::current()` from outside of a runtime could be very surprising, since it would start up a background reactor. --- tokio-reactor/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tokio-reactor/src/lib.rs b/tokio-reactor/src/lib.rs index 23cef8270..249fe36f1 100644 --- a/tokio-reactor/src/lib.rs +++ b/tokio-reactor/src/lib.rs @@ -455,7 +455,8 @@ impl fmt::Debug for Reactor { // ===== impl Handle ===== impl Handle { - /// Returns a handle to the current reactor. + #[doc(hidden)] + #[deprecated(note = "semantics were sometimes surprising, use Handle::default()")] pub fn current() -> Handle { // TODO: Should this panic on error? HandlePriv::try_current()