From e759e0b7397b4343ac9dee881e177a9b8421c436 Mon Sep 17 00:00:00 2001 From: binarycat Date: Wed, 28 Aug 2024 21:30:05 -0400 Subject: [PATCH 1/2] add guarantee about remove_dir and remove_file error kinds approved in ACP https://github.com/rust-lang/libs-team/issues/433 --- library/std/src/fs.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 6a0d9f47960..14e6ee46797 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1989,6 +1989,11 @@ impl AsInner for DirEntry { /// * The file doesn't exist. /// * The user lacks permissions to remove the file. /// +/// This function will only ever return an error of kind `NotFound` if the given +/// path does not exist. Note that the inverse is not true, +/// ie. if a path does not exist, its removal may fail for a number of reasons, +/// such as insufficient permissions. +/// /// # Examples /// /// ```no_run @@ -2446,6 +2451,11 @@ pub fn create_dir_all>(path: P) -> io::Result<()> { /// * The user lacks permissions to remove the directory at the provided `path`. /// * The directory isn't empty. /// +/// This function will only ever return an error of kind `NotFound` if the given +/// path does not exist. Note that the inverse is not true, +/// ie. if a path does not exist, its removal may fail for a number of reasons, +/// such as insufficient permissions. +/// /// # Examples /// /// ```no_run From c72264157b36e7333261e6524a457ee511e5e0b6 Mon Sep 17 00:00:00 2001 From: nora <48135649+Noratrieb@users.noreply.github.com> Date: Fri, 20 Sep 2024 19:55:28 +0200 Subject: [PATCH 2/2] Remove double spaces --- library/std/src/fs.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 14e6ee46797..22aa4dfcc77 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1990,7 +1990,7 @@ impl AsInner for DirEntry { /// * The user lacks permissions to remove the file. /// /// This function will only ever return an error of kind `NotFound` if the given -/// path does not exist. Note that the inverse is not true, +/// path does not exist. Note that the inverse is not true, /// ie. if a path does not exist, its removal may fail for a number of reasons, /// such as insufficient permissions. /// @@ -2452,7 +2452,7 @@ pub fn create_dir_all>(path: P) -> io::Result<()> { /// * The directory isn't empty. /// /// This function will only ever return an error of kind `NotFound` if the given -/// path does not exist. Note that the inverse is not true, +/// path does not exist. Note that the inverse is not true, /// ie. if a path does not exist, its removal may fail for a number of reasons, /// such as insufficient permissions. ///