Skip to content

Commit 7dc2213

Browse files
authored
Rollup merge of rust-lang#141472 - fluiderson:dev, r=workingjubilee
Attempt to improve the `std::fs::create_dir_all` docs related to atomicity The original paragraph was added in rust-lang#124520. It doesn't match the actual code logic. It says "function returns an error" if "the parent components" _(which also implies directories)_ "have been created already". The code is as follows: https://github.com/rust-lang/rust/blob/e88e85463468ce5d5ce468414eb69e3b15fa8d42/library/std/src/fs.rs#L3146 https://github.com/rust-lang/rust/blob/e88e85463468ce5d5ce468414eb69e3b15fa8d42/library/std/src/fs.rs#L3160 These lines suppress all errors if any path component is a directory. I've updated the paragraph to mirror this.
2 parents 25e04e0 + 6d47489 commit 7dc2213

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/std/src/fs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2803,8 +2803,8 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> {
28032803
/// Recursively create a directory and all of its parent components if they
28042804
/// are missing.
28052805
///
2806-
/// If this function returns an error, some of the parent components might have
2807-
/// been created already.
2806+
/// This function is not atomic. If it returns an error, any parent components it was able to create
2807+
/// will remain.
28082808
///
28092809
/// If the empty path is passed to this function, it always succeeds without
28102810
/// creating any directories.

0 commit comments

Comments
 (0)