Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions library/core/src/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,14 @@ pub enum ErrorKind {
#[unstable(feature = "io_error_too_many_open_files", issue = "158319")]
TooManyOpenFiles,

/// A low-level input/output error.
///
/// This usually indicates a hardware or device-level failure, such as a bad
/// disk sector or a removed device, but the operating system may also report
/// it for other low-level I/O conditions.
#[unstable(feature = "io_error_input_output_error", issue = "159066")]
InputOutputError,

// "Unusual" error kinds which do not correspond simply to (sets
// of) OS error codes, should be added just above this comment.
// `Other` and `Uncategorized` should remain at the end:
Expand Down Expand Up @@ -1001,6 +1009,7 @@ impl ErrorKind {
FilesystemLoop => "filesystem loop or indirection limit (e.g. symlink loop)",
HostUnreachable => "host unreachable",
InProgress => "in progress",
InputOutputError => "input/output error",
Interrupted => "operation interrupted",
InvalidData => "invalid data",
InvalidFilename => "invalid filename",
Expand Down Expand Up @@ -1093,6 +1102,7 @@ impl ErrorKind {
OutOfMemory,
InProgress,
TooManyOpenFiles,
InputOutputError,
Uncategorized,
})
}
Expand Down
1 change: 1 addition & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@
#![feature(hint_must_use)]
#![feature(int_from_ascii)]
#![feature(io_error_inprogress)]
#![feature(io_error_input_output_error)]
#![feature(io_error_more)]
#![feature(io_error_too_many_open_files)]
#![feature(io_error_uncategorized)]
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/fs/vexos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ fn map_fresult(fresult: vex_sdk::FRESULT) -> io::Result<()> {
match fresult {
vex_sdk::FRESULT::FR_OK => Ok(()),
vex_sdk::FRESULT::FR_DISK_ERR => Err(io::const_error!(
io::ErrorKind::Uncategorized,
io::ErrorKind::InputOutputError,
"internal function reported an unrecoverable hard error",
)),
vex_sdk::FRESULT::FR_INT_ERR => Err(io::const_error!(
Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/io/error/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ pub fn decode_error_kind(errno: i32) -> io::ErrorKind {
libc::EINPROGRESS => InProgress,
libc::EMFILE | libc::ENFILE => TooManyOpenFiles,
libc::EOPNOTSUPP => Unsupported,
libc::EIO => InputOutputError,

libc::EACCES | libc::EPERM => PermissionDenied,

Expand Down
1 change: 1 addition & 0 deletions library/std/src/sys/io/error/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ pub fn decode_error_kind(errno: i32) -> io::ErrorKind {
c::ERROR_TOO_MANY_OPEN_FILES => return TooManyOpenFiles,
c::ERROR_FILENAME_EXCED_RANGE => return InvalidFilename,
c::ERROR_CANT_RESOLVE_FILENAME => return FilesystemLoop,
c::ERROR_IO_DEVICE => return InputOutputError,
_ => {}
}

Expand Down
Loading