Skip to content

Commit

Permalink
Allow deprecated Error::cause (#818)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
taiki-e authored and carllerche committed Jan 2, 2019
1 parent 30f5967 commit 9a8d087
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/runtime/current_thread/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down
3 changes: 3 additions & 0 deletions tokio-timer/src/throttle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ impl<T: StdError + 'static> StdError for ThrottleError<T> {
}
}

// 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),
Expand Down

0 comments on commit 9a8d087

Please sign in to comment.