diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2025-05-26 03:38:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-26 03:38:18 +0200 |
| commit | a49ae1c40f1e6885d9051071603cca7c9e49cea3 (patch) | |
| tree | c1f5c3cea31d5ad0c485f6add75365334cf264f7 /library/std/src | |
| parent | 8624f9c62f012f253c49da4c33a5445cd8611643 (diff) | |
| parent | 6d47489e568a80b2c29c56b3664cc41c30a8f8fa (diff) | |
Rollup merge of #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/rust#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.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/fs.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 509e673bdb8..8047c0c03ad 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2803,8 +2803,8 @@ pub fn create_dir<P: AsRef<Path>>(path: P) -> io::Result<()> { /// Recursively create a directory and all of its parent components if they /// are missing. /// -/// If this function returns an error, some of the parent components might have -/// been created already. +/// This function is not atomic. If it returns an error, any parent components it was able to create +/// will remain. /// /// If the empty path is passed to this function, it always succeeds without /// creating any directories. |
