mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
Fix problems found on Windows in dir_create_all
Ignore the type of error altogether. The rationale is: it doesn't matter what was the problem if the directory is there. In the previous versions if the directory was there already we wouldn't even attempt to create it, so we wouldn't know about the problem neither. Make test path length smaller in `concurrent_recursive_mkdir` test.
This commit is contained in:
+3
-4
@@ -1777,8 +1777,7 @@ fn _create(&self, path: &Path) -> io::Result<()> {
|
||||
fn create_dir_all(&self, path: &Path) -> io::Result<()> {
|
||||
match self.inner.mkdir(path) {
|
||||
Ok(()) => return Ok(()),
|
||||
Err(ref e)
|
||||
if e.kind() == io::ErrorKind::AlreadyExists && path.is_dir() => return Ok(()),
|
||||
Err(_) if path.is_dir() => return Ok(()),
|
||||
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {}
|
||||
Err(e) => return Err(e),
|
||||
}
|
||||
@@ -1788,7 +1787,7 @@ fn create_dir_all(&self, path: &Path) -> io::Result<()> {
|
||||
}
|
||||
match self.inner.mkdir(path) {
|
||||
Ok(()) => Ok(()),
|
||||
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists && path.is_dir() => Ok(()),
|
||||
Err(_) if path.is_dir() => Ok(()),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
@@ -2280,7 +2279,7 @@ fn recursive_mkdir_failure() {
|
||||
|
||||
#[test]
|
||||
fn concurrent_recursive_mkdir() {
|
||||
for _ in 0..100 {
|
||||
for _ in 0..50 {
|
||||
let mut dir = tmpdir().join("a");
|
||||
for _ in 0..100 {
|
||||
dir = dir.join("a");
|
||||
|
||||
Reference in New Issue
Block a user