Skip to content

Commit a9d5285

Browse files
committed
Auto merge of #29155 - retep998:read-no-dir, r=alexcrichton
Fixes #29150 r? @alexcrichton
2 parents db54339 + dd11d3c commit a9d5285

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/libstd/fs.rs

+6
Original file line numberDiff line numberDiff line change
@@ -2162,4 +2162,10 @@ mod tests {
21622162
}
21632163
}
21642164
}
2165+
2166+
#[test]
2167+
fn read_dir_not_found() {
2168+
let res = fs::read_dir("/path/that/does/not/exist");
2169+
assert_eq!(res.err().unwrap().kind(), ErrorKind::NotFound);
2170+
}
21652171
}

src/libstd/sys/windows/c.rs

+2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
8383
pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
8484
pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
8585

86+
pub const ERROR_PATH_NOT_FOUND: libc::c_int = 3;
87+
8688
#[repr(C)]
8789
#[cfg(target_arch = "x86")]
8890
pub struct WSADATA {

src/libstd/sys/windows/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ pub fn decode_error_kind(errno: i32) -> ErrorKind {
5151
libc::ERROR_ALREADY_EXISTS => ErrorKind::AlreadyExists,
5252
libc::ERROR_BROKEN_PIPE => ErrorKind::BrokenPipe,
5353
libc::ERROR_FILE_NOT_FOUND => ErrorKind::NotFound,
54+
c::ERROR_PATH_NOT_FOUND => ErrorKind::NotFound,
5455
libc::ERROR_NO_DATA => ErrorKind::BrokenPipe,
5556
libc::ERROR_OPERATION_ABORTED => ErrorKind::TimedOut,
5657

0 commit comments

Comments
 (0)