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.
This commit is contained in:
Sean McArthur
2018-12-28 12:09:35 -08:00
committed by GitHub
parent 1a5026324f
commit c8a990eda4
+2 -1
View File
@@ -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()