Provide source method for Error, to allow downcasting cause

This commit is contained in:
David Tolnay 2019-12-26 21:40:43 -05:00
parent 38a73b32c1
commit a59d451809
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -334,7 +334,7 @@ impl Display for ErrorCode {
} }
impl error::Error for Error { impl error::Error for Error {
fn cause(&self) -> Option<&error::Error> { fn source(&self) -> Option<&(error::Error + 'static)> {
match self.err.code { match self.err.code {
ErrorCode::Io(ref err) => Some(err), ErrorCode::Io(ref err) => Some(err),
_ => None, _ => None,