diff --git a/lib/metrics/src/serve.rs b/lib/metrics/src/serve.rs index bfcd45318a43e..f98a867619daa 100644 --- a/lib/metrics/src/serve.rs +++ b/lib/metrics/src/serve.rs @@ -113,7 +113,7 @@ impl fmt::Display for ServeError { f, "{}: {}", self.description(), - self.cause().expect("ServeError must have cause") + self.source().expect("ServeError must have source") ) } } @@ -126,10 +126,10 @@ impl Error for ServeError { } } - fn cause(&self) -> Option<&Error> { + fn source(&self) -> Option<&(dyn Error + 'static)> { match *self { - ServeError::Http(ref cause) => Some(cause), - ServeError::Io(ref cause) => Some(cause), + ServeError::Http(ref source) => Some(source), + ServeError::Io(ref source) => Some(source), } } } diff --git a/lib/router/src/lib.rs b/lib/router/src/lib.rs index 44ea759347e63..249d0417488c2 100644 --- a/lib/router/src/lib.rs +++ b/lib/router/src/lib.rs @@ -262,10 +262,10 @@ where impl error::Error for Error where - T: error::Error, - U: error::Error, + T: error::Error + 'static, + U: error::Error + 'static, { - fn cause(&self) -> Option<&error::Error> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match *self { Error::Inner(ref why) => Some(why), Error::Route(ref why) => Some(why), diff --git a/lib/stack/src/either.rs b/lib/stack/src/either.rs index 095c6a4952e25..ad33713a67e80 100644 --- a/lib/stack/src/either.rs +++ b/lib/stack/src/either.rs @@ -81,10 +81,10 @@ impl fmt::Display for Either { } impl error::Error for Either { - fn cause(&self) -> Option<&error::Error> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self { - Either::A(a) => a.cause(), - Either::B(b) => b.cause(), + Either::A(a) => a.source(), + Either::B(b) => b.source(), } } } diff --git a/lib/timeout/src/lib.rs b/lib/timeout/src/lib.rs index a470e777280bb..07f93b79edad4 100644 --- a/lib/timeout/src/lib.rs +++ b/lib/timeout/src/lib.rs @@ -130,9 +130,9 @@ where impl error::Error for Error where - E: error::Error, + E: error::Error + 'static, { - fn cause(&self) -> Option<&error::Error> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match *self { Error::Error(ref err) => Some(err), Error::Timer(ref err) => Some(err), diff --git a/src/proxy/buffer.rs b/src/proxy/buffer.rs index ec66806d5f0ec..9749a13f7c33a 100644 --- a/src/proxy/buffer.rs +++ b/src/proxy/buffer.rs @@ -117,9 +117,9 @@ impl fmt::Display for Error { } impl error::Error for Error { - fn cause(&self) -> Option<&error::Error> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self { - Error::Stack(e) => e.cause(), + Error::Stack(e) => e.source(), Error::Spawn(_) => None, } } diff --git a/src/proxy/canonicalize.rs b/src/proxy/canonicalize.rs index 4c3604ca7339d..8abbc177fa93d 100644 --- a/src/proxy/canonicalize.rs +++ b/src/proxy/canonicalize.rs @@ -304,10 +304,10 @@ impl fmt::Display for Error { } impl error::Error for Error { - fn cause(&self) -> Option<&error::Error> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self { - Error::Stack(e) => e.cause(), - Error::Service(e) => e.cause(), + Error::Stack(e) => e.source(), + Error::Service(e) => e.source(), } } } diff --git a/src/proxy/http/glue.rs b/src/proxy/http/glue.rs index c64fe97957efb..a631ef6a71756 100644 --- a/src/proxy/http/glue.rs +++ b/src/proxy/http/glue.rs @@ -251,7 +251,7 @@ impl fmt::Display for Error { } impl StdError for Error { - fn cause(&self) -> Option<&StdError> { - self.0.cause() + fn source(&self) -> Option<&(StdError + 'static)> { + self.0.source() } } diff --git a/src/proxy/http/settings.rs b/src/proxy/http/settings.rs index 1b0a061632436..231a95684f203 100644 --- a/src/proxy/http/settings.rs +++ b/src/proxy/http/settings.rs @@ -259,10 +259,10 @@ pub mod router { } impl error::Error for Error { - fn cause(&self) -> Option<&error::Error> { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { match self { - Error::Service(e) => e.cause(), - Error::Stack(e) => e.cause(), + Error::Service(e) => e.source(), + Error::Stack(e) => e.source(), } } }