]> git.lizzy.rs Git - rust.git/commitdiff
Rename ErrorKind::Unknown to Uncategorized.
authorMara Bos <m-ou.se@m-ou.se>
Tue, 15 Jun 2021 12:27:31 +0000 (14:27 +0200)
committerMara Bos <m-ou.se@m-ou.se>
Tue, 15 Jun 2021 12:30:13 +0000 (14:30 +0200)
23 files changed:
library/std/src/fs.rs
library/std/src/fs/tests.rs
library/std/src/io/error.rs
library/std/src/io/mod.rs
library/std/src/net/tcp/tests.rs
library/std/src/os/wasi/fs.rs
library/std/src/sys/hermit/mod.rs
library/std/src/sys/hermit/net.rs
library/std/src/sys/hermit/stdio.rs
library/std/src/sys/hermit/thread.rs
library/std/src/sys/sgx/mod.rs
library/std/src/sys/sgx/net.rs
library/std/src/sys/sgx/stdio.rs
library/std/src/sys/unix/fs.rs
library/std/src/sys/unix/mod.rs
library/std/src/sys/unix/net.rs
library/std/src/sys/unix/os.rs
library/std/src/sys/unsupported/common.rs
library/std/src/sys/wasi/fs.rs
library/std/src/sys/wasi/mod.rs
library/std/src/sys/windows/fs.rs
library/std/src/sys/windows/mod.rs
src/test/ui/write-fmt-errors.rs

index 661077a7756f4b6094ee3c7114c09758b143410b..881ba2e079716587bf964a83c3491be434af889b 100644 (file)
@@ -2190,7 +2190,7 @@ fn create_dir_all(&self, path: &Path) -> io::Result<()> {
             Some(p) => self.create_dir_all(p)?,
             None => {
                 return Err(io::Error::new_const(
-                    io::ErrorKind::Unknown,
+                    io::ErrorKind::Uncategorized,
                     &"failed to create whole tree",
                 ));
             }
index cc856b4cd45c53f4433791294178056cd5186dac..127b7bf34a3dbe30a36ae40a839c5b7f7923de58 100644 (file)
@@ -1329,7 +1329,8 @@ fn metadata_access_times() {
         match (a.created(), b.created()) {
             (Ok(t1), Ok(t2)) => assert!(t1 <= t2),
             (Err(e1), Err(e2))
-                if e1.kind() == ErrorKind::Unknown && e2.kind() == ErrorKind::Unknown
+                if e1.kind() == ErrorKind::Uncategorized
+                    && e2.kind() == ErrorKind::Uncategorized
                     || e1.kind() == ErrorKind::Unsupported
                         && e2.kind() == ErrorKind::Unsupported => {}
             (a, b) => {
index 9eb7e43e284ff0b2f91bce877ea43ec777b3a047..6ca8e0b506c0703bde3bd36825a7632b8d29ab67 100644 (file)
@@ -198,12 +198,12 @@ pub enum ErrorKind {
 
     /// Any I/O error from the standard library that's not part of this list.
     ///
-    /// Errors that are `Unknown` now may move to a different or a new
+    /// Errors that are `Uncategorized` now may move to a different or a new
     /// [`ErrorKind`] variant in the future. It is not recommended to match
-    /// an error against `Unknown`; use a wildcard match (`_`) instead.
-    #[unstable(feature = "io_error_unknown", issue = "none")]
+    /// an error against `Uncategorized`; use a wildcard match (`_`) instead.
+    #[unstable(feature = "io_error_uncategorized", issue = "none")]
     #[doc(hidden)]
-    Unknown,
+    Uncategorized,
 }
 
 impl ErrorKind {
@@ -229,7 +229,7 @@ pub(crate) fn as_str(&self) -> &'static str {
             ErrorKind::Unsupported => "unsupported",
             ErrorKind::OutOfMemory => "out of memory",
             ErrorKind::Other => "other error",
-            ErrorKind::Unknown => "other os error",
+            ErrorKind::Uncategorized => "uncategorized error",
         }
     }
 }
@@ -552,7 +552,7 @@ pub fn into_inner(self) -> Option<Box<dyn error::Error + Send + Sync>> {
     /// }
     ///
     /// fn main() {
-    ///     // Will print "Unknown".
+    ///     // Will print "Uncategorized".
     ///     print_error(Error::last_os_error());
     ///     // Will print "AddrInUse".
     ///     print_error(Error::new(ErrorKind::AddrInUse, "oh no!"));
index 4a605e4928b01e0d461f709aef9966b6e4ea7734..0566f86877f735ec432bc567480da66419dbc73a 100644 (file)
@@ -1592,7 +1592,7 @@ fn write_str(&mut self, s: &str) -> fmt::Result {
                 if output.error.is_err() {
                     output.error
                 } else {
-                    Err(Error::new_const(ErrorKind::Unknown, &"formatter error"))
+                    Err(Error::new_const(ErrorKind::Uncategorized, &"formatter error"))
                 }
             }
         }
index a664a3354627d34e0b0aa72d7dd3af4905e267cc..387a3617e5e9a9de55bc567d5d8c74acef196e27 100644 (file)
@@ -342,7 +342,7 @@ fn double_bind() {
             Err(e) => {
                 assert!(
                     e.kind() == ErrorKind::ConnectionRefused
-                        || e.kind() == ErrorKind::Unknown
+                        || e.kind() == ErrorKind::Uncategorized
                         || e.kind() == ErrorKind::AddrInUse,
                     "unknown error: {} {:?}",
                     e,
index b47dbacee68972fb40c320982a7bdfe54ee539db..7f26f419a4b7ba7d6d5de0daf2b5b52909b2b739 100644 (file)
@@ -532,5 +532,6 @@ pub fn symlink_path<P: AsRef<Path>, U: AsRef<Path>>(old_path: P, new_path: U) ->
 }
 
 fn osstr2str(f: &OsStr) -> io::Result<&str> {
-    f.to_str().ok_or_else(|| io::Error::new_const(io::ErrorKind::Unknown, &"input must be utf-8"))
+    f.to_str()
+        .ok_or_else(|| io::Error::new_const(io::ErrorKind::Uncategorized, &"input must be utf-8"))
 }
index 70a0a8abc320c6b6a0d8bf2b81dd03e745a7f094..10c19424953d2af7b7d20db0ef4d183f33472aed 100644 (file)
@@ -149,7 +149,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
         x if x == 1 as i32 => ErrorKind::PermissionDenied,
         x if x == 32 as i32 => ErrorKind::BrokenPipe,
         x if x == 110 as i32 => ErrorKind::TimedOut,
-        _ => ErrorKind::Unknown,
+        _ => ErrorKind::Uncategorized,
     }
 }
 
index ca6c383f181da1f3e802db781a86c30ca59f1ff5..3f0c99cf74289c639a6934bff9ab194ca471ee38 100644 (file)
@@ -15,7 +15,7 @@
 pub fn init() -> io::Result<()> {
     if abi::network_init() < 0 {
         return Err(io::Error::new_const(
-            ErrorKind::Unknown,
+            ErrorKind::Uncategorized,
             &"Unable to initialize network interface",
         ));
     }
@@ -51,7 +51,7 @@ pub fn connect(addr: io::Result<&SocketAddr>) -> io::Result<TcpStream> {
         match abi::tcpstream::connect(addr.ip().to_string().as_bytes(), addr.port(), None) {
             Ok(handle) => Ok(TcpStream(Arc::new(Socket(handle)))),
             _ => Err(io::Error::new_const(
-                ErrorKind::Unknown,
+                ErrorKind::Uncategorized,
                 &"Unable to initiate a connection on a socket",
             )),
         }
@@ -65,7 +65,7 @@ pub fn connect_timeout(saddr: &SocketAddr, duration: Duration) -> io::Result<Tcp
         ) {
             Ok(handle) => Ok(TcpStream(Arc::new(Socket(handle)))),
             _ => Err(io::Error::new_const(
-                ErrorKind::Unknown,
+                ErrorKind::Uncategorized,
                 &"Unable to initiate a connection on a socket",
             )),
         }
@@ -73,7 +73,9 @@ pub fn connect_timeout(saddr: &SocketAddr, duration: Duration) -> io::Result<Tcp
 
     pub fn set_read_timeout(&self, duration: Option<Duration>) -> io::Result<()> {
         abi::tcpstream::set_read_timeout(*self.0.as_inner(), duration.map(|d| d.as_millis() as u64))
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"Unable to set timeout value"))
+            .map_err(|_| {
+                io::Error::new_const(ErrorKind::Uncategorized, &"Unable to set timeout value")
+            })
     }
 
     pub fn set_write_timeout(&self, duration: Option<Duration>) -> io::Result<()> {
@@ -81,12 +83,12 @@ pub fn set_write_timeout(&self, duration: Option<Duration>) -> io::Result<()> {
             *self.0.as_inner(),
             duration.map(|d| d.as_millis() as u64),
         )
-        .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"Unable to set timeout value"))
+        .map_err(|_| io::Error::new_const(ErrorKind::Uncategorized, &"Unable to set timeout value"))
     }
 
     pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
         let duration = abi::tcpstream::get_read_timeout(*self.0.as_inner()).map_err(|_| {
-            io::Error::new_const(ErrorKind::Unknown, &"Unable to determine timeout value")
+            io::Error::new_const(ErrorKind::Uncategorized, &"Unable to determine timeout value")
         })?;
 
         Ok(duration.map(|d| Duration::from_millis(d)))
@@ -94,7 +96,7 @@ pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
 
     pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
         let duration = abi::tcpstream::get_write_timeout(*self.0.as_inner()).map_err(|_| {
-            io::Error::new_const(ErrorKind::Unknown, &"Unable to determine timeout value")
+            io::Error::new_const(ErrorKind::Uncategorized, &"Unable to determine timeout value")
         })?;
 
         Ok(duration.map(|d| Duration::from_millis(d)))
@@ -102,7 +104,7 @@ pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
 
     pub fn peek(&self, buf: &mut [u8]) -> io::Result<usize> {
         abi::tcpstream::peek(*self.0.as_inner(), buf)
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"peek failed"))
+            .map_err(|_| io::Error::new_const(ErrorKind::Uncategorized, &"peek failed"))
     }
 
     pub fn read(&self, buffer: &mut [u8]) -> io::Result<usize> {
@@ -114,7 +116,7 @@ pub fn read_vectored(&self, ioslice: &mut [IoSliceMut<'_>]) -> io::Result<usize>
 
         for i in ioslice.iter_mut() {
             let ret = abi::tcpstream::read(*self.0.as_inner(), &mut i[0..]).map_err(|_| {
-                io::Error::new_const(ErrorKind::Unknown, &"Unable to read on socket")
+                io::Error::new_const(ErrorKind::Uncategorized, &"Unable to read on socket")
             })?;
 
             if ret != 0 {
@@ -139,7 +141,7 @@ pub fn write_vectored(&self, ioslice: &[IoSlice<'_>]) -> io::Result<usize> {
 
         for i in ioslice.iter() {
             size += abi::tcpstream::write(*self.0.as_inner(), i).map_err(|_| {
-                io::Error::new_const(ErrorKind::Unknown, &"Unable to write on socket")
+                io::Error::new_const(ErrorKind::Uncategorized, &"Unable to write on socket")
             })?;
         }
 
@@ -153,13 +155,13 @@ pub fn is_write_vectored(&self) -> bool {
 
     pub fn peer_addr(&self) -> io::Result<SocketAddr> {
         let (ipaddr, port) = abi::tcpstream::peer_addr(*self.0.as_inner())
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"peer_addr failed"))?;
+            .map_err(|_| io::Error::new_const(ErrorKind::Uncategorized, &"peer_addr failed"))?;
 
         let saddr = match ipaddr {
             Ipv4(ref addr) => SocketAddr::new(IpAddr::V4(Ipv4Addr::from(addr.0)), port),
             Ipv6(ref addr) => SocketAddr::new(IpAddr::V6(Ipv6Addr::from(addr.0)), port),
             _ => {
-                return Err(io::Error::new_const(ErrorKind::Unknown, &"peer_addr failed"));
+                return Err(io::Error::new_const(ErrorKind::Uncategorized, &"peer_addr failed"));
             }
         };
 
@@ -171,8 +173,9 @@ pub fn socket_addr(&self) -> io::Result<SocketAddr> {
     }
 
     pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {
-        abi::tcpstream::shutdown(*self.0.as_inner(), how as i32)
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"unable to shutdown socket"))
+        abi::tcpstream::shutdown(*self.0.as_inner(), how as i32).map_err(|_| {
+            io::Error::new_const(ErrorKind::Uncategorized, &"unable to shutdown socket")
+        })
     }
 
     pub fn duplicate(&self) -> io::Result<TcpStream> {
@@ -181,22 +184,22 @@ pub fn duplicate(&self) -> io::Result<TcpStream> {
 
     pub fn set_nodelay(&self, mode: bool) -> io::Result<()> {
         abi::tcpstream::set_nodelay(*self.0.as_inner(), mode)
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"set_nodelay failed"))
+            .map_err(|_| io::Error::new_const(ErrorKind::Uncategorized, &"set_nodelay failed"))
     }
 
     pub fn nodelay(&self) -> io::Result<bool> {
         abi::tcpstream::nodelay(*self.0.as_inner())
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"nodelay failed"))
+            .map_err(|_| io::Error::new_const(ErrorKind::Uncategorized, &"nodelay failed"))
     }
 
     pub fn set_ttl(&self, tll: u32) -> io::Result<()> {
         abi::tcpstream::set_tll(*self.0.as_inner(), tll)
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"unable to set TTL"))
+            .map_err(|_| io::Error::new_const(ErrorKind::Uncategorized, &"unable to set TTL"))
     }
 
     pub fn ttl(&self) -> io::Result<u32> {
         abi::tcpstream::get_tll(*self.0.as_inner())
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"unable to get TTL"))
+            .map_err(|_| io::Error::new_const(ErrorKind::Uncategorized, &"unable to get TTL"))
     }
 
     pub fn take_error(&self) -> io::Result<Option<io::Error>> {
@@ -204,8 +207,9 @@ pub fn take_error(&self) -> io::Result<Option<io::Error>> {
     }
 
     pub fn set_nonblocking(&self, mode: bool) -> io::Result<()> {
-        abi::tcpstream::set_nonblocking(*self.0.as_inner(), mode)
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"unable to set blocking mode"))
+        abi::tcpstream::set_nonblocking(*self.0.as_inner(), mode).map_err(|_| {
+            io::Error::new_const(ErrorKind::Uncategorized, &"unable to set blocking mode")
+        })
     }
 }
 
@@ -231,12 +235,12 @@ pub fn socket_addr(&self) -> io::Result<SocketAddr> {
 
     pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
         let (handle, ipaddr, port) = abi::tcplistener::accept(self.0.port())
-            .map_err(|_| io::Error::new_const(ErrorKind::Unknown, &"accept failed"))?;
+            .map_err(|_| io::Error::new_const(ErrorKind::Uncategorized, &"accept failed"))?;
         let saddr = match ipaddr {
             Ipv4(ref addr) => SocketAddr::new(IpAddr::V4(Ipv4Addr::from(addr.0)), port),
             Ipv6(ref addr) => SocketAddr::new(IpAddr::V6(Ipv6Addr::from(addr.0)), port),
             _ => {
-                return Err(io::Error::new_const(ErrorKind::Unknown, &"accept failed"));
+                return Err(io::Error::new_const(ErrorKind::Uncategorized, &"accept failed"));
             }
         };
 
index e3c3912fc58741db815e39af0695bc7c042d9d0a..33b8390431f6d5327fa57abf590016ca4713dc78 100644 (file)
@@ -40,7 +40,7 @@ fn write(&mut self, data: &[u8]) -> io::Result<usize> {
         unsafe { len = abi::write(1, data.as_ptr() as *const u8, data.len()) }
 
         if len < 0 {
-            Err(io::Error::new_const(io::ErrorKind::Unknown, &"Stdout is not able to print"))
+            Err(io::Error::new_const(io::ErrorKind::Uncategorized, &"Stdout is not able to print"))
         } else {
             Ok(len as usize)
         }
@@ -52,7 +52,7 @@ fn write_vectored(&mut self, data: &[IoSlice<'_>]) -> io::Result<usize> {
         unsafe { len = abi::write(1, data.as_ptr() as *const u8, data.len()) }
 
         if len < 0 {
-            Err(io::Error::new_const(io::ErrorKind::Unknown, &"Stdout is not able to print"))
+            Err(io::Error::new_const(io::ErrorKind::Uncategorized, &"Stdout is not able to print"))
         } else {
             Ok(len as usize)
         }
@@ -81,7 +81,7 @@ fn write(&mut self, data: &[u8]) -> io::Result<usize> {
         unsafe { len = abi::write(2, data.as_ptr() as *const u8, data.len()) }
 
         if len < 0 {
-            Err(io::Error::new_const(io::ErrorKind::Unknown, &"Stderr is not able to print"))
+            Err(io::Error::new_const(io::ErrorKind::Uncategorized, &"Stderr is not able to print"))
         } else {
             Ok(len as usize)
         }
@@ -93,7 +93,7 @@ fn write_vectored(&mut self, data: &[IoSlice<'_>]) -> io::Result<usize> {
         unsafe { len = abi::write(2, data.as_ptr() as *const u8, data.len()) }
 
         if len < 0 {
-            Err(io::Error::new_const(io::ErrorKind::Unknown, &"Stderr is not able to print"))
+            Err(io::Error::new_const(io::ErrorKind::Uncategorized, &"Stderr is not able to print"))
         } else {
             Ok(len as usize)
         }
index 2c5d218dc2898282def2f2623aba841f02b880f3..56f438b6af6764aa4662746d06f22d2c14ad935c 100644 (file)
@@ -37,7 +37,7 @@ pub unsafe fn new_with_coreid(
             // The thread failed to start and as a result p was not consumed. Therefore, it is
             // safe to reconstruct the box so that it gets deallocated.
             drop(Box::from_raw(p));
-            Err(io::Error::new_const(io::ErrorKind::Unknown, &"Unable to create thread!"))
+            Err(io::Error::new_const(io::ErrorKind::Uncategorized, &"Unable to create thread!"))
         } else {
             Ok(Thread { tid: tid })
         };
index ae7b98281a30925f004f01e207c57be959601738..fce6b4207328b7677901c4079fd6042b28e039c6 100644 (file)
@@ -70,7 +70,7 @@ pub fn sgx_ineffective<T>(v: T) -> crate::io::Result<T> {
     static SGX_INEFFECTIVE_ERROR: AtomicBool = AtomicBool::new(false);
     if SGX_INEFFECTIVE_ERROR.load(Ordering::Relaxed) {
         Err(crate::io::Error::new_const(
-            ErrorKind::Unknown,
+            ErrorKind::Uncategorized,
             &"operation can't be trusted to have any effect on SGX",
         ))
     } else {
@@ -115,11 +115,11 @@ pub fn decode_error_kind(code: i32) -> ErrorKind {
     } else if code == Error::Interrupted as _ {
         ErrorKind::Interrupted
     } else if code == Error::Other as _ {
-        ErrorKind::Unknown
+        ErrorKind::Uncategorized
     } else if code == Error::UnexpectedEof as _ {
         ErrorKind::UnexpectedEof
     } else {
-        ErrorKind::Unknown
+        ErrorKind::Uncategorized
     }
 }
 
index b2b5972eb412c2d0583c7113cce32f60fd499e6c..3a69aa039ef2e703e087245eb37fe21dd8eafcbe 100644 (file)
@@ -466,7 +466,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 
 impl LookupHost {
     fn new(host: String) -> io::Result<LookupHost> {
-        Err(io::Error::new(io::ErrorKind::Unknown, NonIpSockAddr { host }))
+        Err(io::Error::new(io::ErrorKind::Uncategorized, NonIpSockAddr { host }))
     }
 
     pub fn port(&self) -> u16 {
index f9e3d83be4370105a1797619bd1981c139777467..8ccf043b5b57f00cbb64df58a6ac85833e5e2230 100644 (file)
@@ -65,7 +65,7 @@ fn flush(&mut self) -> io::Result<()> {
 pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
 
 pub fn is_ebadf(err: &io::Error) -> bool {
-    // FIXME: Rust normally maps Unix EBADF to `Unknown`
+    // FIXME: Rust normally maps Unix EBADF to `Uncategorized`
     err.raw_os_error() == Some(abi::Error::BrokenPipe as _)
 }
 
index ed0ba7cf3eeed0e69e541b6709d234a428c38306..a428ce94c8e8632ea00bbceab87abba334f471ee 100644 (file)
@@ -358,7 +358,7 @@ pub fn created(&self) -> io::Result<SystemTime> {
                     }))
                 } else {
                     Err(io::Error::new_const(
-                        io::ErrorKind::Unknown,
+                        io::ErrorKind::Uncategorized,
                         &"creation time is not available for the filesystem",
                     ))
                 };
index ae16ea07f247824a1f55f3cbbe8da1ffae84e843..21c718825b889c6081a8934068460dc990ad01c8 100644 (file)
@@ -155,7 +155,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
         // clause
         x if x == libc::EAGAIN || x == libc::EWOULDBLOCK => ErrorKind::WouldBlock,
 
-        _ => ErrorKind::Unknown,
+        _ => ErrorKind::Uncategorized,
     }
 }
 
index 9db670408c3e757084f033640ea737a0a5306293..50c225ae2c1d91d0b8d294fb0a2f10d7e61b7daa 100644 (file)
@@ -38,7 +38,7 @@ pub fn cvt_gai(err: c_int) -> io::Result<()> {
         str::from_utf8(CStr::from_ptr(libc::gai_strerror(err)).to_bytes()).unwrap().to_owned()
     };
     Err(io::Error::new(
-        io::ErrorKind::Unknown,
+        io::ErrorKind::Uncategorized,
         &format!("failed to lookup address information: {}", detail)[..],
     ))
 }
@@ -178,7 +178,7 @@ pub fn connect_timeout(&self, addr: &SocketAddr, timeout: Duration) -> io::Resul
                     if pollfd.revents & libc::POLLHUP != 0 {
                         let e = self.take_error()?.unwrap_or_else(|| {
                             io::Error::new_const(
-                                io::ErrorKind::Unknown,
+                                io::ErrorKind::Uncategorized,
                                 &"no error set after POLLHUP",
                             )
                         });
index f0fc1f605801548d93030c311e38905e2b42bfdd..c0befad2b9d76bc30af230ec4fa618a2ba1ba0e8 100644 (file)
@@ -280,7 +280,7 @@ fn sysctl() -> io::Result<PathBuf> {
             ))?;
             if path_len <= 1 {
                 return Err(io::Error::new_const(
-                    io::ErrorKind::Unknown,
+                    io::ErrorKind::Uncategorized,
                     &"KERN_PROC_PATHNAME sysctl returned zero-length string",
                 ));
             }
@@ -303,7 +303,7 @@ fn procfs() -> io::Result<PathBuf> {
             return crate::fs::read_link(curproc_exe);
         }
         Err(io::Error::new_const(
-            io::ErrorKind::Unknown,
+            io::ErrorKind::Uncategorized,
             &"/proc/curproc/exe doesn't point to regular file.",
         ))
     }
@@ -321,7 +321,10 @@ pub fn current_exe() -> io::Result<PathBuf> {
         cvt(libc::sysctl(mib, 4, argv.as_mut_ptr() as *mut _, &mut argv_len, ptr::null_mut(), 0))?;
         argv.set_len(argv_len as usize);
         if argv[0].is_null() {
-            return Err(io::Error::new_const(io::ErrorKind::Unknown, &"no current exe available"));
+            return Err(io::Error::new_const(
+                io::ErrorKind::Uncategorized,
+                &"no current exe available",
+            ));
         }
         let argv0 = CStr::from_ptr(argv[0]).to_bytes();
         if argv0[0] == b'.' || argv0.iter().any(|b| *b == b'/') {
@@ -336,7 +339,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
 pub fn current_exe() -> io::Result<PathBuf> {
     match crate::fs::read_link("/proc/self/exe") {
         Err(ref e) if e.kind() == io::ErrorKind::NotFound => Err(io::Error::new_const(
-            io::ErrorKind::Unknown,
+            io::ErrorKind::Uncategorized,
             &"no /proc/self/exe available. Is /proc mounted?",
         )),
         other => other,
@@ -423,7 +426,7 @@ fn _get_next_image_info(
             _get_next_image_info(0, &mut cookie, &mut info, mem::size_of::<image_info>() as i32);
         if result != 0 {
             use crate::io::ErrorKind;
-            Err(io::Error::new_const(ErrorKind::Unknown, &"Error getting executable path"))
+            Err(io::Error::new_const(ErrorKind::Uncategorized, &"Error getting executable path"))
         } else {
             let name = CStr::from_ptr(info.name.as_ptr()).to_bytes();
             Ok(PathBuf::from(OsStr::from_bytes(name)))
index 523185f9c8f9065e590fd7482d75793c98715db0..4e6c301d29f5470fdc85d0492fe1ed06d094a083 100644 (file)
@@ -30,7 +30,7 @@ pub fn unsupported_err() -> std_io::Error {
 }
 
 pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind {
-    crate::io::ErrorKind::Unknown
+    crate::io::ErrorKind::Uncategorized
 }
 
 pub fn abort_internal() -> ! {
index 75eaa8446a3578bf7008106fb0088c3a301a0666..8ffa1c88d88e75f89a1cd4c4ee18d86c36b6357b 100644 (file)
@@ -648,7 +648,7 @@ fn open_parent(p: &Path) -> io::Result<(ManuallyDrop<WasiFd>, PathBuf)> {
                      through which {:?} could be opened",
                     p
                 );
-                return Err(io::Error::new(io::ErrorKind::Unknown, msg));
+                return Err(io::Error::new(io::ErrorKind::Uncategorized, msg));
             }
             let relative = CStr::from_ptr(relative_path).to_bytes().to_vec();
 
@@ -670,7 +670,8 @@ pub fn __wasilibc_find_relpath(
 }
 
 pub fn osstr2str(f: &OsStr) -> io::Result<&str> {
-    f.to_str().ok_or_else(|| io::Error::new_const(io::ErrorKind::Unknown, &"input must be utf-8"))
+    f.to_str()
+        .ok_or_else(|| io::Error::new_const(io::ErrorKind::Uncategorized, &"input must be utf-8"))
 }
 
 pub fn copy(from: &Path, to: &Path) -> io::Result<u64> {
index 1710721318166cc76f3509af9e75f87c3ff2aecd..4af99bfa464781d59aa7fbe79e97ce90d87ea855 100644 (file)
@@ -58,7 +58,7 @@
 pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind {
     use std_io::ErrorKind::*;
     if errno > u16::MAX as i32 || errno < 0 {
-        return Unknown;
+        return Uncategorized;
     }
     match errno as u16 {
         wasi::ERRNO_CONNREFUSED => ConnectionRefused,
@@ -77,7 +77,7 @@ pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind {
         wasi::ERRNO_AGAIN => WouldBlock,
         wasi::ERRNO_NOSYS => Unsupported,
         wasi::ERRNO_NOMEM => OutOfMemory,
-        _ => Unknown,
+        _ => Uncategorized,
     }
 }
 
index 1f3fb6f0c24403e062f5fd004bd86047f5d711b3..c677adae6888e0c30e24e182539584bef1873784 100644 (file)
@@ -514,7 +514,7 @@ fn readlink(&self) -> io::Result<PathBuf> {
                 }
                 _ => {
                     return Err(io::Error::new_const(
-                        io::ErrorKind::Unknown,
+                        io::ErrorKind::Uncategorized,
                         &"Unsupported reparse point type",
                     ));
                 }
index 5e857af85c1e4ec61300aa3961d84b0d557ae539..ab455a8a3764293dd983e222e9850ea218f60fe4 100644 (file)
@@ -103,7 +103,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
         c::WSAEWOULDBLOCK => ErrorKind::WouldBlock,
         c::WSAETIMEDOUT => ErrorKind::TimedOut,
 
-        _ => ErrorKind::Unknown,
+        _ => ErrorKind::Uncategorized,
     }
 }
 
index afbe4e3b2ceb8e5081e077b8b9ba5eabf7188630..3fcaefaa63ef1517c4ef0323805205a4a565dcdc 100644 (file)
@@ -1,6 +1,6 @@
 // run-pass
 
-#![feature(io_error_unknown)]
+#![feature(io_error_uncategorized)]
 
 use std::fmt;
 use std::io::{self, Error, Write, sink};
@@ -15,7 +15,7 @@ fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
 
 struct ErrorWriter;
 
-const FORMAT_ERROR: io::ErrorKind = io::ErrorKind::Unknown;
+const FORMAT_ERROR: io::ErrorKind = io::ErrorKind::Uncategorized;
 const WRITER_ERROR: io::ErrorKind = io::ErrorKind::NotConnected;
 
 impl Write for ErrorWriter {