From 9a8d087c69fbc9fcf6c32481297de14a333d114c Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 3 Jan 2019 07:12:11 +0900 Subject: [PATCH] Allow deprecated Error::cause (#818) Error::cause is deprecated in Rust 1.33, but this allows Error::cause until the minimum supported version of tokio is Rust 1.30. When the minimum support version of tokio reaches Rust 1.30, replace Error::cause with Error::source. Fixes: #817 --- src/runtime/current_thread/runtime.rs | 4 ++++ tokio-timer/src/throttle.rs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/runtime/current_thread/runtime.rs b/src/runtime/current_thread/runtime.rs index 262cb1e72..6bb2b0767 100644 --- a/src/runtime/current_thread/runtime.rs +++ b/src/runtime/current_thread/runtime.rs @@ -92,6 +92,10 @@ impl Error for RunError { fn description(&self) -> &str { self.inner.description() } + + // FIXME(taiki-e): When the minimum support version of tokio reaches Rust 1.30, + // replace this with Error::source. + #[allow(deprecated)] fn cause(&self) -> Option<&Error> { self.inner.cause() } diff --git a/tokio-timer/src/throttle.rs b/tokio-timer/src/throttle.rs index c1da76bbf..12e889576 100644 --- a/tokio-timer/src/throttle.rs +++ b/tokio-timer/src/throttle.rs @@ -161,6 +161,9 @@ impl StdError for ThrottleError { } } + // FIXME(taiki-e): When the minimum support version of tokio reaches Rust 1.30, + // replace this with Error::source. + #[allow(deprecated)] fn cause(&self) -> Option<&StdError> { match self.0 { Either::A(ref err) => Some(err),