From 4458b5a9d5f11af5cfeb2201a4065131baeeec36 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 26 May 2015 20:39:14 -0700 Subject: [PATCH] Delegate io::Error::cause to inner error --- src/libstd/io/error.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs index 97c5a29d308..70e6d7eb265 100644 --- a/src/libstd/io/error.rs +++ b/src/libstd/io/error.rs @@ -215,6 +215,13 @@ impl error::Error for Error { Repr::Custom(ref c) => c.error.description(), } } + + fn cause(&self) -> Option<&Error> { + match self.repr { + Repr::Os(..) => None, + Repr::Custom(ref c) => c.error.cause(), + } + } } fn _assert_error_is_sync_send() {