mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Add error kind handling for ERROR_PATH_NOT_FOUND
Fixes #29150 Signed-off-by: Peter Atashian <retep998@gmail.com>
This commit is contained in:
parent
d3f497861d
commit
dd11d3c619
@ -2162,4 +2162,10 @@ mod tests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn read_dir_not_found() {
|
||||||
|
let res = fs::read_dir("/path/that/does/not/exist");
|
||||||
|
assert_eq!(res.err().unwrap().kind(), ErrorKind::NotFound);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,8 @@ pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
|
|||||||
pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
|
pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
|
||||||
pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
|
pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
|
||||||
|
|
||||||
|
pub const ERROR_PATH_NOT_FOUND: libc::c_int = 3;
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
pub struct WSADATA {
|
pub struct WSADATA {
|
||||||
|
@ -51,6 +51,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
|
|||||||
libc::ERROR_ALREADY_EXISTS => ErrorKind::AlreadyExists,
|
libc::ERROR_ALREADY_EXISTS => ErrorKind::AlreadyExists,
|
||||||
libc::ERROR_BROKEN_PIPE => ErrorKind::BrokenPipe,
|
libc::ERROR_BROKEN_PIPE => ErrorKind::BrokenPipe,
|
||||||
libc::ERROR_FILE_NOT_FOUND => ErrorKind::NotFound,
|
libc::ERROR_FILE_NOT_FOUND => ErrorKind::NotFound,
|
||||||
|
c::ERROR_PATH_NOT_FOUND => ErrorKind::NotFound,
|
||||||
libc::ERROR_NO_DATA => ErrorKind::BrokenPipe,
|
libc::ERROR_NO_DATA => ErrorKind::BrokenPipe,
|
||||||
libc::ERROR_OPERATION_ABORTED => ErrorKind::TimedOut,
|
libc::ERROR_OPERATION_ABORTED => ErrorKind::TimedOut,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user