diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-02-19 18:52:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-19 18:52:05 +0100 |
| commit | e6406ad4dd75d5349226534e9210b40ca0e31c77 (patch) | |
| tree | b3978ada970a41124e8505238528ed98a661aebb /library/std | |
| parent | 2c1e1bd2cb30e2d21fa6612eea92ab8f96b30dff (diff) | |
| parent | 3ad847779ec12875a96c563dadb63493b28856c0 (diff) | |
| download | rust-e6406ad4dd75d5349226534e9210b40ca0e31c77.tar.gz rust-e6406ad4dd75d5349226534e9210b40ca0e31c77.zip | |
Rollup merge of #136347 - allevo:patch-1, r=Amanieu
Add a bullet point to `std::fs::copy`
I needed to copy a file but I got the following error:
```
Os { code: 2, kind: NotFound, message: "No such file or directory" }
```
After read the documentation, I though the error was generated by the `from` parameter, forgetting the `to` part. Anyway, I got the error because the parent folder of `to` didn't exist.
Even if the documentation explicitly saying `but is not limited to just these cases`, I would like to add this case because I spent 3 hours around it.
This PR just wants to put a mention about it.
Diffstat (limited to 'library/std')
| -rw-r--r-- | library/std/src/fs.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index c340b43352f..340ddf1e120 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2531,6 +2531,7 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()> /// * `from` does not exist. /// * The current process does not have the permission rights to read /// `from` or write `to`. +/// * The parent directory of `to` doesn't exist. /// /// # Examples /// |
