Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit04e46c2

Browse files
authored
Rollup merge ofrust-lang#125112 - tbu-:pr_create_dir_all_empty, r=dtolnay
Document behavior of `create_dir_all` wrt. empty pathThe 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.Closesrust-lang#105108 by documenting the current behavior.
2 parentsae7f43e +8fa3f60 commit04e46c2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎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)

[8]ページ先頭

©2009-2025 Movatter.jp