Skip to content

Commit 378a011

Browse files
authored
Rollup merge of rust-lang#58963 - seanmonstar:patch-3, r=cramertj
libstd: implement Error::source for io::Error
2 parents 54a5073 + 0d39797 commit 378a011

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: src/libstd/io/error.rs

+8
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,14 @@ impl error::Error for Error {
556556
Repr::Custom(ref c) => c.error.cause(),
557557
}
558558
}
559+
560+
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
561+
match self.repr {
562+
Repr::Os(..) => None,
563+
Repr::Simple(..) => None,
564+
Repr::Custom(ref c) => c.error.source(),
565+
}
566+
}
559567
}
560568

561569
fn _assert_error_is_sync_send() {

0 commit comments

Comments
 (0)