diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 42a68496fc4..30e553f285b 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2284,6 +2284,11 @@ pub fn remove_dir>(path: P) -> io::Result<()> { /// /// See [`fs::remove_file`] and [`fs::remove_dir`]. /// +/// `remove_dir_all` will fail if `remove_dir` or `remove_file` fail on any constituent paths, including the root path. +/// As a result, the directory you are deleting must exist, meaning that this function is not idempotent. +/// +/// Consider ignoring the error if validating the removal is not required for your use case. +/// /// [`fs::remove_file`]: remove_file /// [`fs::remove_dir`]: remove_dir ///