Auto merge of #29155 - retep998:read-no-dir, r=alexcrichton

Fixes #29150 

r? @alexcrichton
This commit is contained in:
bors 2015-10-20 10:06:42 +00:00
commit a9d5285344
3 changed files with 9 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -83,6 +83,8 @@ pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
pub const ERROR_PATH_NOT_FOUND: libc::c_int = 3;
#[repr(C)]
#[cfg(target_arch = "x86")]
pub struct WSADATA {

View File

@ -51,6 +51,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
libc::ERROR_ALREADY_EXISTS => ErrorKind::AlreadyExists,
libc::ERROR_BROKEN_PIPE => ErrorKind::BrokenPipe,
libc::ERROR_FILE_NOT_FOUND => ErrorKind::NotFound,
c::ERROR_PATH_NOT_FOUND => ErrorKind::NotFound,
libc::ERROR_NO_DATA => ErrorKind::BrokenPipe,
libc::ERROR_OPERATION_ABORTED => ErrorKind::TimedOut,