diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2019-03-08 09:42:10 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-08 09:42:10 +0100 |
| commit | 378a0118f36f99425773bbd3b6dd9db571616f5c (patch) | |
| tree | 1b6acfa9343b57f80ee60bfd8b6345808a779f14 /src/libstd | |
| parent | 54a5073af99ec927ceaa01de90743534cbd39e80 (diff) | |
| parent | 0d39797dc0d787c8dde695a2c0ac1262fedc77cb (diff) | |
Rollup merge of #58963 - seanmonstar:patch-3, r=cramertj
libstd: implement Error::source for io::Error
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/error.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index fdc5625ff18..614b79124cc 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() { |
