Skip to content

Commit 4cdfcdc

Browse files
matthiaskrgrgitbot
authored and
gitbot
committed
Rollup merge of rust-lang#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.
2 parents cbe0653 + 41da80b commit 4cdfcdc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

std/src/fs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2531,6 +2531,7 @@ pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> io::Result<()>
25312531
/// * `from` does not exist.
25322532
/// * The current process does not have the permission rights to read
25332533
/// `from` or write `to`.
2534+
/// * The parent directory of `to` doesn't exist.
25342535
///
25352536
/// # Examples
25362537
///

0 commit comments

Comments
 (0)