Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 4481b6c

Browse files
authored
Unrolled build for rust-lang#125112
Rollup merge of rust-lang#125112 - tbu-:pr_create_dir_all_empty, r=dtolnay Document behavior of `create_dir_all` wrt. empty path The behavior makes sense because `Path::new("one_component").parent() == Some(Path::new(""))`, so if one naively wants to create the parent directory for a file to be written, it simply works. Closes rust-lang#105108 by documenting the current behavior.
2 parents 5639c21 + 6add5c9 commit 4481b6c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/std/src/fs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2386,6 +2386,9 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
23862386
/// If this function returns an error, some of the parent components might have
23872387
/// been created already.
23882388
///
2389+
/// If the empty path is passed to this function, it always succeeds without
2390+
/// creating any directories.
2391+
///
23892392
/// # Platform-specific behavior
23902393
///
23912394
/// This function currently corresponds to multiple calls to the `mkdir`

0 commit comments

Comments
 (0)