diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index fdc5625ff184..614b79124cc6 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -556,6 +556,14 @@ impl error::Error for Error { Repr::Custom(ref c) => c.error.cause(), } } + + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + match self.repr { + Repr::Os(..) => None, + Repr::Simple(..) => None, + Repr::Custom(ref c) => c.error.source(), + } + } } fn _assert_error_is_sync_send() {