about summary refs log tree commit diff
path: root/library/std/src/sys/pal/unix
diff options
context:
space:
mode:
Diffstat (limited to 'library/std/src/sys/pal/unix')
-rw-r--r--library/std/src/sys/pal/unix/fs.rs26
-rw-r--r--library/std/src/sys/pal/unix/l4re.rs2
-rw-r--r--library/std/src/sys/pal/unix/net.rs4
-rw-r--r--library/std/src/sys/pal/unix/os.rs23
-rw-r--r--library/std/src/sys/pal/unix/process/process_fuchsia.rs8
-rw-r--r--library/std/src/sys/pal/unix/process/process_unix.rs10
-rw-r--r--library/std/src/sys/pal/unix/process/process_vxworks.rs2
-rw-r--r--library/std/src/sys/pal/unix/thread.rs4
-rw-r--r--library/std/src/sys/pal/unix/time.rs2
9 files changed, 40 insertions, 41 deletions
diff --git a/library/std/src/sys/pal/unix/fs.rs b/library/std/src/sys/pal/unix/fs.rs
index 96f99efb21e..37029bcd36e 100644
--- a/library/std/src/sys/pal/unix/fs.rs
+++ b/library/std/src/sys/pal/unix/fs.rs
@@ -559,7 +559,7 @@ impl FileAttr {
                 return if (ext.stx_mask & libc::STATX_BTIME) != 0 {
                     SystemTime::new(ext.stx_btime.tv_sec, ext.stx_btime.tv_nsec as i64)
                 } else {
-                    Err(io::const_io_error!(
+                    Err(io::const_error!(
                         io::ErrorKind::Unsupported,
                         "creation time is not available for the filesystem",
                     ))
@@ -567,7 +567,7 @@ impl FileAttr {
             }
         }
 
-        Err(io::const_io_error!(
+        Err(io::const_error!(
             io::ErrorKind::Unsupported,
             "creation time is not available on this platform \
                             currently",
@@ -1272,7 +1272,7 @@ impl File {
         target_vendor = "apple",
     )))]
     pub fn lock(&self) -> io::Result<()> {
-        Err(io::const_io_error!(io::ErrorKind::Unsupported, "lock() not supported"))
+        Err(io::const_error!(io::ErrorKind::Unsupported, "lock() not supported"))
     }
 
     #[cfg(any(
@@ -1293,7 +1293,7 @@ impl File {
         target_vendor = "apple",
     )))]
     pub fn lock_shared(&self) -> io::Result<()> {
-        Err(io::const_io_error!(io::ErrorKind::Unsupported, "lock_shared() not supported"))
+        Err(io::const_error!(io::ErrorKind::Unsupported, "lock_shared() not supported"))
     }
 
     #[cfg(any(
@@ -1320,7 +1320,7 @@ impl File {
         target_vendor = "apple",
     )))]
     pub fn try_lock(&self) -> io::Result<bool> {
-        Err(io::const_io_error!(io::ErrorKind::Unsupported, "try_lock() not supported"))
+        Err(io::const_error!(io::ErrorKind::Unsupported, "try_lock() not supported"))
     }
 
     #[cfg(any(
@@ -1347,7 +1347,7 @@ impl File {
         target_vendor = "apple",
     )))]
     pub fn try_lock_shared(&self) -> io::Result<bool> {
-        Err(io::const_io_error!(io::ErrorKind::Unsupported, "try_lock_shared() not supported"))
+        Err(io::const_error!(io::ErrorKind::Unsupported, "try_lock_shared() not supported"))
     }
 
     #[cfg(any(
@@ -1368,7 +1368,7 @@ impl File {
         target_vendor = "apple",
     )))]
     pub fn unlock(&self) -> io::Result<()> {
-        Err(io::const_io_error!(io::ErrorKind::Unsupported, "unlock() not supported"))
+        Err(io::const_error!(io::ErrorKind::Unsupported, "unlock() not supported"))
     }
 
     pub fn truncate(&self, size: u64) -> io::Result<()> {
@@ -1459,11 +1459,11 @@ impl File {
         )))]
         let to_timespec = |time: Option<SystemTime>| match time {
             Some(time) if let Some(ts) = time.t.to_timespec() => Ok(ts),
-            Some(time) if time > crate::sys::time::UNIX_EPOCH => Err(io::const_io_error!(
+            Some(time) if time > crate::sys::time::UNIX_EPOCH => Err(io::const_error!(
                 io::ErrorKind::InvalidInput,
                 "timestamp is too large to set as a file time"
             )),
-            Some(_) => Err(io::const_io_error!(
+            Some(_) => Err(io::const_error!(
                 io::ErrorKind::InvalidInput,
                 "timestamp is too small to set as a file time"
             )),
@@ -1476,7 +1476,7 @@ impl File {
                 // the same as for Redox.
                 // `futimens` and `UTIME_OMIT` are a work in progress for vxworks.
                 let _ = times;
-                Err(io::const_io_error!(
+                Err(io::const_error!(
                     io::ErrorKind::Unsupported,
                     "setting file times not supported",
                 ))
@@ -1515,7 +1515,7 @@ impl File {
                     weak!(fn futimens(c_int, *const libc::timespec) -> c_int);
                     match futimens.get() {
                         Some(futimens) => futimens(self.as_raw_fd(), times.as_ptr()),
-                        None => return Err(io::const_io_error!(
+                        None => return Err(io::const_error!(
                             io::ErrorKind::Unsupported,
                             "setting file times requires Android API level >= 19",
                         )),
@@ -2090,7 +2090,7 @@ pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
 #[cfg(target_os = "vxworks")]
 pub fn lchown(path: &Path, uid: u32, gid: u32) -> io::Result<()> {
     let (_, _, _) = (path, uid, gid);
-    Err(io::const_io_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks"))
+    Err(io::const_error!(io::ErrorKind::Unsupported, "lchown not supported by vxworks"))
 }
 
 #[cfg(not(any(target_os = "fuchsia", target_os = "vxworks")))]
@@ -2101,7 +2101,7 @@ pub fn chroot(dir: &Path) -> io::Result<()> {
 #[cfg(target_os = "vxworks")]
 pub fn chroot(dir: &Path) -> io::Result<()> {
     let _ = dir;
-    Err(io::const_io_error!(io::ErrorKind::Unsupported, "chroot not supported by vxworks"))
+    Err(io::const_error!(io::ErrorKind::Unsupported, "chroot not supported by vxworks"))
 }
 
 pub use remove_dir_impl::remove_dir_all;
diff --git a/library/std/src/sys/pal/unix/l4re.rs b/library/std/src/sys/pal/unix/l4re.rs
index 52d39dcfb16..37dd370c514 100644
--- a/library/std/src/sys/pal/unix/l4re.rs
+++ b/library/std/src/sys/pal/unix/l4re.rs
@@ -1,6 +1,6 @@
 macro_rules! unimpl {
     () => {
-        return Err(io::const_io_error!(
+        return Err(io::const_error!(
             io::ErrorKind::Unsupported,
             "No networking available on L4Re.",
         ));
diff --git a/library/std/src/sys/pal/unix/net.rs b/library/std/src/sys/pal/unix/net.rs
index 6a67bb0a101..d140607869c 100644
--- a/library/std/src/sys/pal/unix/net.rs
+++ b/library/std/src/sys/pal/unix/net.rs
@@ -190,7 +190,7 @@ impl Socket {
         loop {
             let elapsed = start.elapsed();
             if elapsed >= timeout {
-                return Err(io::const_io_error!(io::ErrorKind::TimedOut, "connection timed out"));
+                return Err(io::const_error!(io::ErrorKind::TimedOut, "connection timed out"));
             }
 
             let timeout = timeout - elapsed;
@@ -225,7 +225,7 @@ impl Socket {
                         // for POLLHUP or POLLERR rather than read readiness
                         if pollfd.revents & (libc::POLLHUP | libc::POLLERR) != 0 {
                             let e = self.take_error()?.unwrap_or_else(|| {
-                                io::const_io_error!(
+                                io::const_error!(
                                     io::ErrorKind::Uncategorized,
                                     "no error set after POLLHUP",
                                 )
diff --git a/library/std/src/sys/pal/unix/os.rs b/library/std/src/sys/pal/unix/os.rs
index f207131ddf3..789a40c13e6 100644
--- a/library/std/src/sys/pal/unix/os.rs
+++ b/library/std/src/sys/pal/unix/os.rs
@@ -258,7 +258,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
     use crate::env;
     use crate::io::ErrorKind;
 
-    let exe_path = env::args().next().ok_or(io::const_io_error!(
+    let exe_path = env::args().next().ok_or(io::const_error!(
         ErrorKind::NotFound,
         "an executable path was not found because no arguments were provided through argv"
     ))?;
@@ -284,7 +284,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
             }
         }
     }
-    Err(io::const_io_error!(ErrorKind::NotFound, "an executable path was not found"))
+    Err(io::const_error!(ErrorKind::NotFound, "an executable path was not found"))
 }
 
 #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))]
@@ -340,7 +340,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
                 0,
             ))?;
             if path_len <= 1 {
-                return Err(io::const_io_error!(
+                return Err(io::const_error!(
                     io::ErrorKind::Uncategorized,
                     "KERN_PROC_PATHNAME sysctl returned zero-length string",
                 ));
@@ -363,7 +363,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
         if curproc_exe.is_file() {
             return crate::fs::read_link(curproc_exe);
         }
-        Err(io::const_io_error!(
+        Err(io::const_error!(
             io::ErrorKind::Uncategorized,
             "/proc/curproc/exe doesn't point to regular file.",
         ))
@@ -382,10 +382,9 @@ 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::const_io_error!(
-                io::ErrorKind::Uncategorized,
-                "no current exe available",
-            ));
+            return Err(
+                io::const_error!(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'/') {
@@ -405,7 +404,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::const_io_error!(
+        Err(ref e) if e.kind() == io::ErrorKind::NotFound => Err(io::const_error!(
             io::ErrorKind::Uncategorized,
             "no /proc/self/exe available. Is /proc mounted?",
         )),
@@ -476,7 +475,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
         );
         if result != libc::B_OK {
             use crate::io::ErrorKind;
-            Err(io::const_io_error!(ErrorKind::Uncategorized, "Error getting executable path"))
+            Err(io::const_error!(ErrorKind::Uncategorized, "Error getting executable path"))
         } else {
             // find_path adds the null terminator.
             let name = CStr::from_ptr(name.as_ptr()).to_bytes();
@@ -493,7 +492,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
 #[cfg(target_os = "l4re")]
 pub fn current_exe() -> io::Result<PathBuf> {
     use crate::io::ErrorKind;
-    Err(io::const_io_error!(ErrorKind::Unsupported, "Not yet implemented!"))
+    Err(io::const_error!(ErrorKind::Unsupported, "Not yet implemented!"))
 }
 
 #[cfg(target_os = "vxworks")]
@@ -523,7 +522,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
     use crate::env;
     use crate::io::ErrorKind;
 
-    let exe_path = env::args().next().ok_or(io::const_io_error!(
+    let exe_path = env::args().next().ok_or(io::const_error!(
         ErrorKind::Uncategorized,
         "an executable path was not found because no arguments were provided through argv"
     ))?;
diff --git a/library/std/src/sys/pal/unix/process/process_fuchsia.rs b/library/std/src/sys/pal/unix/process/process_fuchsia.rs
index 8f7d786e32f..b7a35718757 100644
--- a/library/std/src/sys/pal/unix/process/process_fuchsia.rs
+++ b/library/std/src/sys/pal/unix/process/process_fuchsia.rs
@@ -18,7 +18,7 @@ impl Command {
         let envp = self.capture_env();
 
         if self.saw_nul() {
-            return Err(io::const_io_error!(
+            return Err(io::const_error!(
                 io::ErrorKind::InvalidInput,
                 "nul byte found in provided data",
             ));
@@ -38,7 +38,7 @@ impl Command {
 
     pub fn exec(&mut self, default: Stdio) -> io::Error {
         if self.saw_nul() {
-            return io::const_io_error!(
+            return io::const_error!(
                 io::ErrorKind::InvalidInput,
                 "nul byte found in provided data",
             );
@@ -185,7 +185,7 @@ impl Process {
             ))?;
         }
         if actual != 1 {
-            return Err(io::const_io_error!(
+            return Err(io::const_error!(
                 io::ErrorKind::InvalidData,
                 "Failed to get exit status of process",
             ));
@@ -222,7 +222,7 @@ impl Process {
             ))?;
         }
         if actual != 1 {
-            return Err(io::const_io_error!(
+            return Err(io::const_error!(
                 io::ErrorKind::InvalidData,
                 "Failed to get exit status of process",
             ));
diff --git a/library/std/src/sys/pal/unix/process/process_unix.rs b/library/std/src/sys/pal/unix/process/process_unix.rs
index 8faf1fda546..ec4965c1d71 100644
--- a/library/std/src/sys/pal/unix/process/process_unix.rs
+++ b/library/std/src/sys/pal/unix/process/process_unix.rs
@@ -61,7 +61,7 @@ impl Command {
         let envp = self.capture_env();
 
         if self.saw_nul() {
-            return Err(io::const_io_error!(
+            return Err(io::const_error!(
                 ErrorKind::InvalidInput,
                 "nul byte found in provided data",
             ));
@@ -175,7 +175,7 @@ impl Command {
     // allowed to exist in dead code), but it sounds bad, so we go out of our
     // way to avoid that all-together.
     #[cfg(any(target_os = "tvos", target_os = "watchos"))]
-    const ERR_APPLE_TV_WATCH_NO_FORK_EXEC: Error = io::const_io_error!(
+    const ERR_APPLE_TV_WATCH_NO_FORK_EXEC: Error = io::const_error!(
         ErrorKind::Unsupported,
         "`fork`+`exec`-based process spawning is not supported on this target",
     );
@@ -218,7 +218,7 @@ impl Command {
                 } else if delay < MAX_FORKSPAWN_SLEEP {
                     thread::sleep(delay);
                 } else {
-                    return Err(io::const_io_error!(
+                    return Err(io::const_error!(
                         ErrorKind::WouldBlock,
                         "forking returned EBADF too often",
                     ));
@@ -235,7 +235,7 @@ impl Command {
         let envp = self.capture_env();
 
         if self.saw_nul() {
-            return io::const_io_error!(ErrorKind::InvalidInput, "nul byte found in provided data",);
+            return io::const_error!(ErrorKind::InvalidInput, "nul byte found in provided data",);
         }
 
         match self.setup_io(default, true) {
@@ -561,7 +561,7 @@ impl Command {
                         } else if delay < MAX_FORKSPAWN_SLEEP {
                             thread::sleep(delay);
                         } else {
-                            return Err(io::const_io_error!(
+                            return Err(io::const_error!(
                                 ErrorKind::WouldBlock,
                                 "posix_spawnp returned EBADF too often",
                             ));
diff --git a/library/std/src/sys/pal/unix/process/process_vxworks.rs b/library/std/src/sys/pal/unix/process/process_vxworks.rs
index 38daf6af918..e2c1b6a0326 100644
--- a/library/std/src/sys/pal/unix/process/process_vxworks.rs
+++ b/library/std/src/sys/pal/unix/process/process_vxworks.rs
@@ -22,7 +22,7 @@ impl Command {
         let envp = self.capture_env();
 
         if self.saw_nul() {
-            return Err(io::const_io_error!(
+            return Err(io::const_error!(
                 ErrorKind::InvalidInput,
                 "nul byte found in provided data",
             ));
diff --git a/library/std/src/sys/pal/unix/thread.rs b/library/std/src/sys/pal/unix/thread.rs
index 04024661836..131a6e81b1e 100644
--- a/library/std/src/sys/pal/unix/thread.rs
+++ b/library/std/src/sys/pal/unix/thread.rs
@@ -469,7 +469,7 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
             unsafe {
                 use libc::_syspage_ptr;
                 if _syspage_ptr.is_null() {
-                    Err(io::const_io_error!(io::ErrorKind::NotFound, "No syspage available"))
+                    Err(io::const_error!(io::ErrorKind::NotFound, "No syspage available"))
                 } else {
                     let cpus = (*_syspage_ptr).num_cpu;
                     NonZero::new(cpus as usize)
@@ -509,7 +509,7 @@ pub fn available_parallelism() -> io::Result<NonZero<usize>> {
             }
         } else {
             // FIXME: implement on Redox, l4re
-            Err(io::const_io_error!(io::ErrorKind::Unsupported, "Getting the number of hardware threads is not supported on the target platform"))
+            Err(io::const_error!(io::ErrorKind::Unsupported, "Getting the number of hardware threads is not supported on the target platform"))
         }
     }
 }
diff --git a/library/std/src/sys/pal/unix/time.rs b/library/std/src/sys/pal/unix/time.rs
index 535fe6b27d9..343864d0b3f 100644
--- a/library/std/src/sys/pal/unix/time.rs
+++ b/library/std/src/sys/pal/unix/time.rs
@@ -96,7 +96,7 @@ impl Timespec {
         if tv_nsec >= 0 && tv_nsec < NSEC_PER_SEC as i64 {
             Ok(unsafe { Self::new_unchecked(tv_sec, tv_nsec) })
         } else {
-            Err(io::const_io_error!(io::ErrorKind::InvalidData, "Invalid timestamp"))
+            Err(io::const_error!(io::ErrorKind::InvalidData, "Invalid timestamp"))
         }
     }