Skip to content

Commit af0dec2

Browse files
committed
Rename NotSupported to Unsupported
1 parent 1b5f117 commit af0dec2

File tree

14 files changed

+29
-18
lines changed

14 files changed

+29
-18
lines changed

library/std/src/io/error.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,11 @@ pub enum ErrorKind {
181181
#[stable(feature = "read_exact", since = "1.6.0")]
182182
UnexpectedEof,
183183

184-
/// This operation is not supported on this platform.
185-
#[stable(feature = "not_supported_error", since = "1.52.0")]
186-
NotSupported,
184+
/// This operation is unsupported on this platform.
185+
///
186+
/// This means that the operation can never succeed.
187+
#[stable(feature = "unsupported_error", since = "1.52.0")]
188+
Unsupported,
187189
}
188190

189191
impl ErrorKind {
@@ -207,7 +209,7 @@ impl ErrorKind {
207209
ErrorKind::Interrupted => "operation interrupted",
208210
ErrorKind::Other => "other os error",
209211
ErrorKind::UnexpectedEof => "unexpected end of file",
210-
ErrorKind::NotSupported => "not supported",
212+
ErrorKind::Unsupported => "unsupported",
211213
}
212214
}
213215
}

library/std/src/sys/hermit/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn unsupported<T>() -> crate::io::Result<T> {
5656

5757
pub fn unsupported_err() -> crate::io::Error {
5858
crate::io::Error::new_const(
59-
crate::io::ErrorKind::NotSupported,
59+
crate::io::ErrorKind::Unsupported,
6060
&"operation not supported on HermitCore yet",
6161
)
6262
}

library/std/src/sys/sgx/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn unsupported<T>() -> crate::io::Result<T> {
5050
}
5151

5252
pub fn unsupported_err() -> crate::io::Error {
53-
crate::io::Error::new_const(ErrorKind::NotSupported, &"operation not supported on SGX yet")
53+
crate::io::Error::new_const(ErrorKind::Unsupported, &"operation not supported on SGX yet")
5454
}
5555

5656
/// This function is used to implement various functions that doesn't exist,

library/std/src/sys/unix/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ impl FileAttr {
366366
}
367367

368368
Err(io::Error::new_const(
369-
io::ErrorKind::NotSupported,
369+
io::ErrorKind::Unsupported,
370370
&"creation time is not available on this platform \
371371
currently",
372372
))

library/std/src/sys/unix/l4re.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
macro_rules! unimpl {
22
() => {
3-
return Err(io::Error::new_const(io::ErrorKind::NotSupported, &"No networking available on L4Re."));
3+
return Err(io::Error::new_const(
4+
io::ErrorKind::Unsupported,
5+
&"No networking available on L4Re.",
6+
));
47
};
58
}
69

library/std/src/sys/unix/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
148148
libc::EINVAL => ErrorKind::InvalidInput,
149149
libc::ETIMEDOUT => ErrorKind::TimedOut,
150150
libc::EEXIST => ErrorKind::AlreadyExists,
151-
libc::ENOSYS => ErrorKind::NotSupported,
151+
libc::ENOSYS => ErrorKind::Unsupported,
152152

153153
// These two constants can have the same value on some systems,
154154
// but different values on others, so we can't use a match

library/std/src/sys/unix/os.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
447447
#[cfg(any(target_os = "fuchsia", target_os = "l4re"))]
448448
pub fn current_exe() -> io::Result<PathBuf> {
449449
use crate::io::ErrorKind;
450-
Err(io::Error::new_const(ErrorKind::NotSupported, &"Not yet implemented!"))
450+
Err(io::Error::new_const(ErrorKind::Unsupported, &"Not yet implemented!"))
451451
}
452452

453453
#[cfg(target_os = "vxworks")]

library/std/src/sys/unsupported/common.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ pub fn unsupported<T>() -> std_io::Result<T> {
1818
}
1919

2020
pub fn unsupported_err() -> std_io::Error {
21-
std_io::Error::new_const(std_io::ErrorKind::NotSupported, &"operation not supported on this platform")
21+
std_io::Error::new_const(
22+
std_io::ErrorKind::Unsupported,
23+
&"operation not supported on this platform",
24+
)
2225
}
2326

2427
pub fn decode_error_kind(_code: i32) -> crate::io::ErrorKind {

library/std/src/sys/unsupported/os.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ pub fn getenv(_: &OsStr) -> io::Result<Option<OsString>> {
8080
}
8181

8282
pub fn setenv(_: &OsStr, _: &OsStr) -> io::Result<()> {
83-
Err(io::Error::new_const(io::ErrorKind::NotSupported, &"cannot set env vars on this platform"))
83+
Err(io::Error::new_const(io::ErrorKind::Unsupported, &"cannot set env vars on this platform"))
8484
}
8585

8686
pub fn unsetenv(_: &OsStr) -> io::Result<()> {
87-
Err(io::Error::new_const(io::ErrorKind::NotSupported, &"cannot unset env vars on this platform"))
87+
Err(io::Error::new_const(io::ErrorKind::Unsupported, &"cannot unset env vars on this platform"))
8888
}
8989

9090
pub fn temp_dir() -> PathBuf {

library/std/src/sys/vxworks/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
8383
libc::EINVAL => ErrorKind::InvalidInput,
8484
libc::ETIMEDOUT => ErrorKind::TimedOut,
8585
libc::EEXIST => ErrorKind::AlreadyExists,
86-
libc::ENOSYS => ErrorKind::NotSupported,
86+
libc::ENOSYS => ErrorKind::Unsupported,
8787

8888
// These two constants can have the same value on some systems,
8989
// but different values on others, so we can't use a match

library/std/src/sys/wasi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub fn decode_error_kind(errno: i32) -> std_io::ErrorKind {
7878
wasi::ERRNO_TIMEDOUT => TimedOut,
7979
wasi::ERRNO_EXIST => AlreadyExists,
8080
wasi::ERRNO_AGAIN => WouldBlock,
81-
wasi::ERRNO_NOSYS => NotSupported,
81+
wasi::ERRNO_NOSYS => Unsupported,
8282
_ => Other,
8383
}
8484
}

library/std/src/sys/windows/fs.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,10 @@ pub fn link(original: &Path, link: &Path) -> io::Result<()> {
802802

803803
#[cfg(target_vendor = "uwp")]
804804
pub fn link(_original: &Path, _link: &Path) -> io::Result<()> {
805-
return Err(io::Error::new_const(io::ErrorKind::NotSupported, &"hard link are not supported on UWP"));
805+
return Err(io::Error::new_const(
806+
io::ErrorKind::Unsupported,
807+
&"hard link are not supported on UWP",
808+
));
806809
}
807810

808811
pub fn stat(path: &Path) -> io::Result<FileAttr> {

library/std/src/sys/windows/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
7878
| c::ERROR_IPSEC_IKE_TIMED_OUT
7979
| c::ERROR_RUNLEVEL_SWITCH_TIMEOUT
8080
| c::ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT => return ErrorKind::TimedOut,
81-
c::ERROR_CALL_NOT_IMPLEMENTED => return ErrorKind::NotSupported,
81+
c::ERROR_CALL_NOT_IMPLEMENTED => return ErrorKind::Unsupported,
8282
_ => {}
8383
}
8484

library/std/src/sys/windows/net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl Socket {
370370

371371
#[cfg(target_vendor = "uwp")]
372372
fn set_no_inherit(&self) -> io::Result<()> {
373-
Err(io::Error::new_const(io::ErrorKind::NotSupported, &"Unavailable on UWP"))
373+
Err(io::Error::new_const(io::ErrorKind::Unsupported, &"Unavailable on UWP"))
374374
}
375375

376376
pub fn shutdown(&self, how: Shutdown) -> io::Result<()> {

0 commit comments

Comments
 (0)