diff --git a/library/std/src/io/error.rs b/library/std/src/io/error.rs index a300e5459a6..f9d45b9aafb 100644 --- a/library/std/src/io/error.rs +++ b/library/std/src/io/error.rs @@ -181,9 +181,11 @@ pub enum ErrorKind { #[stable(feature = "read_exact", since = "1.6.0")] UnexpectedEof, - /// This operation is not supported on this platform. - #[stable(feature = "not_supported_error", since = "1.52.0")] - NotSupported, + /// This operation is unsupported on this platform. + /// + /// This means that the operation can never succeed. + #[stable(feature = "unsupported_error", since = "1.52.0")] + Unsupported, } impl ErrorKind { @@ -207,7 +209,7 @@ impl ErrorKind { ErrorKind::Interrupted => "operation interrupted", ErrorKind::Other => "other os error", ErrorKind::UnexpectedEof => "unexpected end of file", - ErrorKind::NotSupported => "not supported", + ErrorKind::Unsupported => "unsupported", } } } diff --git a/library/std/src/sys/hermit/mod.rs b/library/std/src/sys/hermit/mod.rs index 1fa929e48db..f8c1612d1ca 100644 --- a/library/std/src/sys/hermit/mod.rs +++ b/library/std/src/sys/hermit/mod.rs @@ -56,7 +56,7 @@ pub fn unsupported() -> crate::io::Result { pub fn unsupported_err() -> crate::io::Error { crate::io::Error::new_const( - crate::io::ErrorKind::NotSupported, + crate::io::ErrorKind::Unsupported, &"operation not supported on HermitCore yet", ) } diff --git a/library/std/src/sys/sgx/mod.rs b/library/std/src/sys/sgx/mod.rs index 7636413fefb..da37d1aeb7e 100644 --- a/library/std/src/sys/sgx/mod.rs +++ b/library/std/src/sys/sgx/mod.rs @@ -50,7 +50,7 @@ pub fn unsupported() -> crate::io::Result { } pub fn unsupported_err() -> crate::io::Error { - crate::io::Error::new_const(ErrorKind::NotSupported, &"operation not supported on SGX yet") + crate::io::Error::new_const(ErrorKind::Unsupported, &"operation not supported on SGX yet") } /// This function is used to implement various functions that doesn't exist, diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index 1113c7821b2..16a7f727696 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -366,7 +366,7 @@ impl FileAttr { } Err(io::Error::new_const( - io::ErrorKind::NotSupported, + io::ErrorKind::Unsupported, &"creation time is not available on this platform \ currently", )) diff --git a/library/std/src/sys/unix/l4re.rs b/library/std/src/sys/unix/l4re.rs index 6d2d1c5a84a..3cf637c8228 100644 --- a/library/std/src/sys/unix/l4re.rs +++ b/library/std/src/sys/unix/l4re.rs @@ -1,6 +1,9 @@ macro_rules! unimpl { () => { - return Err(io::Error::new_const(io::ErrorKind::NotSupported, &"No networking available on L4Re.")); + return Err(io::Error::new_const( + io::ErrorKind::Unsupported, + &"No networking available on L4Re.", + )); }; } diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 7b99e0fe1f9..6e44ac19c7b 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -148,7 +148,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { libc::EINVAL => ErrorKind::InvalidInput, libc::ETIMEDOUT => ErrorKind::TimedOut, libc::EEXIST => ErrorKind::AlreadyExists, - libc::ENOSYS => ErrorKind::NotSupported, + libc::ENOSYS => ErrorKind::Unsupported, // These two constants can have the same value on some systems, // but different values on others, so we can't use a match diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index 216bc3b5d6d..98e578c5255 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -447,7 +447,7 @@ pub fn current_exe() -> io::Result { #[cfg(any(target_os = "fuchsia", target_os = "l4re"))] pub fn current_exe() -> io::Result { use crate::io::ErrorKind; - Err(io::Error::new_const(ErrorKind::NotSupported, &"Not yet implemented!")) + Err(io::Error::new_const(ErrorKind::Unsupported, &"Not yet implemented!")) } #[cfg(target_os = "vxworks")] diff --git a/library/std/src/sys/unsupported/common.rs b/library/std/src/sys/unsupported/common.rs index 9d18b83d563..64ec50fa9ec 100644 --- a/library/std/src/sys/unsupported/common.rs +++ b/library/std/src/sys/unsupported/common.rs @@ -18,7 +18,10 @@ pub fn unsupported() -> std_io::Result { } pub fn unsupported_err() -> std_io::Error { - std_io::Error::new_const(std_io::ErrorKind::NotSupported, &"operation not supported on this platform") + std_io::Error::new_const( + std_io::ErrorKind::Unsupported, + &"operation not supported on this platform", + ) } pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind { diff --git a/library/std/src/sys/unsupported/os.rs b/library/std/src/sys/unsupported/os.rs index bd94e2d629e..3754aebf455 100644 --- a/library/std/src/sys/unsupported/os.rs +++ b/library/std/src/sys/unsupported/os.rs @@ -80,11 +80,11 @@ pub fn getenv(_: &OsStr) -> io::Result> { } pub fn setenv(_: &OsStr, _: &OsStr) -> io::Result<()> { - Err(io::Error::new_const(io::ErrorKind::NotSupported, &"cannot set env vars on this platform")) + Err(io::Error::new_const(io::ErrorKind::Unsupported, &"cannot set env vars on this platform")) } pub fn unsetenv(_: &OsStr) -> io::Result<()> { - Err(io::Error::new_const(io::ErrorKind::NotSupported, &"cannot unset env vars on this platform")) + Err(io::Error::new_const(io::ErrorKind::Unsupported, &"cannot unset env vars on this platform")) } pub fn temp_dir() -> PathBuf { diff --git a/library/std/src/sys/vxworks/mod.rs b/library/std/src/sys/vxworks/mod.rs index 95e4baf3a6d..12d0147a129 100644 --- a/library/std/src/sys/vxworks/mod.rs +++ b/library/std/src/sys/vxworks/mod.rs @@ -83,7 +83,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { libc::EINVAL => ErrorKind::InvalidInput, libc::ETIMEDOUT => ErrorKind::TimedOut, libc::EEXIST => ErrorKind::AlreadyExists, - libc::ENOSYS => ErrorKind::NotSupported, + libc::ENOSYS => ErrorKind::Unsupported, // These two constants can have the same value on some systems, // but different values on others, so we can't use a match diff --git a/library/std/src/sys/wasi/mod.rs b/library/std/src/sys/wasi/mod.rs index c772fc0be69..b7b640b174f 100644 --- a/library/std/src/sys/wasi/mod.rs +++ b/library/std/src/sys/wasi/mod.rs @@ -78,7 +78,7 @@ pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind { wasi::ERRNO_TIMEDOUT => TimedOut, wasi::ERRNO_EXIST => AlreadyExists, wasi::ERRNO_AGAIN => WouldBlock, - wasi::ERRNO_NOSYS => NotSupported, + wasi::ERRNO_NOSYS => Unsupported, _ => Other, } } diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs index ef68405b103..8e6bd76f85f 100644 --- a/library/std/src/sys/windows/fs.rs +++ b/library/std/src/sys/windows/fs.rs @@ -802,7 +802,10 @@ pub fn link(original: &Path, link: &Path) -> io::Result<()> { #[cfg(target_vendor = "uwp")] pub fn link(_original: &Path, _link: &Path) -> io::Result<()> { - return Err(io::Error::new_const(io::ErrorKind::NotSupported, &"hard link are not supported on UWP")); + return Err(io::Error::new_const( + io::ErrorKind::Unsupported, + &"hard link are not supported on UWP", + )); } pub fn stat(path: &Path) -> io::Result { diff --git a/library/std/src/sys/windows/mod.rs b/library/std/src/sys/windows/mod.rs index c8fada3c0c2..973301af2d9 100644 --- a/library/std/src/sys/windows/mod.rs +++ b/library/std/src/sys/windows/mod.rs @@ -78,7 +78,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind { | c::ERROR_IPSEC_IKE_TIMED_OUT | c::ERROR_RUNLEVEL_SWITCH_TIMEOUT | c::ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT => return ErrorKind::TimedOut, - c::ERROR_CALL_NOT_IMPLEMENTED => return ErrorKind::NotSupported, + c::ERROR_CALL_NOT_IMPLEMENTED => return ErrorKind::Unsupported, _ => {} } diff --git a/library/std/src/sys/windows/net.rs b/library/std/src/sys/windows/net.rs index f6691ccd3e1..ad04afc0b6d 100644 --- a/library/std/src/sys/windows/net.rs +++ b/library/std/src/sys/windows/net.rs @@ -370,7 +370,7 @@ impl Socket { #[cfg(target_vendor = "uwp")] fn set_no_inherit(&self) -> io::Result<()> { - Err(io::Error::new_const(io::ErrorKind::NotSupported, &"Unavailable on UWP")) + Err(io::Error::new_const(io::ErrorKind::Unsupported, &"Unavailable on UWP")) } pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {