about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-12-12 12:47:03 +0000
committerbors <bors@rust-lang.org>2015-12-12 12:47:03 +0000
commitf0ed9f91690a205dd60a7b27dc01674bd03b87ca (patch)
treea959f178e353323b3b414a7dbd2b3acaf34acbf4 /src/libstd
parente583ab628141fc750bbf3277085f4d4d6a0e207d (diff)
parent025f97a1def6c5fc2169931c18ee818ba5479f84 (diff)
downloadrust-f0ed9f91690a205dd60a7b27dc01674bd03b87ca.tar.gz
rust-f0ed9f91690a205dd60a7b27dc01674bd03b87ca.zip
Auto merge of #30312 - seanmonstar:ioerror-description, r=alexcrichton
cc @pnkfelix @alexcrichton
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/error.rs24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs
index 1ff8f572a7f..1dd96f5ddfc 100644
--- a/src/libstd/io/error.rs
+++ b/src/libstd/io/error.rs
@@ -311,9 +311,31 @@ impl fmt::Display for Error {
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl error::Error for Error {
+    #[allow(deprecated)] // remove with UnexpectedEOF
     fn description(&self) -> &str {
         match self.repr {
-            Repr::Os(..) => "os error",
+            Repr::Os(..) => match self.kind() {
+                ErrorKind::NotFound => "entity not found",
+                ErrorKind::PermissionDenied => "permission denied",
+                ErrorKind::ConnectionRefused => "connection refused",
+                ErrorKind::ConnectionReset => "connection reset",
+                ErrorKind::ConnectionAborted => "connection aborted",
+                ErrorKind::NotConnected => "not connected",
+                ErrorKind::AddrInUse => "address in use",
+                ErrorKind::AddrNotAvailable => "address not available",
+                ErrorKind::BrokenPipe => "broken pipe",
+                ErrorKind::AlreadyExists => "entity already exists",
+                ErrorKind::WouldBlock => "operation would block",
+                ErrorKind::InvalidInput => "invalid input parameter",
+                ErrorKind::InvalidData => "invalid data",
+                ErrorKind::TimedOut => "timed out",
+                ErrorKind::WriteZero => "write zero",
+                ErrorKind::Interrupted => "operation interrupted",
+                ErrorKind::Other => "other os error",
+                ErrorKind::UnexpectedEOF => "unexpected end of file",
+                ErrorKind::UnexpectedEof => "unexpected end of file",
+                ErrorKind::__Nonexhaustive => unreachable!()
+            },
             Repr::Custom(ref c) => c.error.description(),
         }
     }