From 7c5108f8572689d2e957f3313cf910d48213304d Mon Sep 17 00:00:00 2001 From: c Date: Mon, 24 Nov 2025 12:02:34 +0100 Subject: [PATCH 1/3] fix: clarify that fs::rename on unix accepts targets that don't exist --- library/std/src/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 8b3e943b4ccd0..1950e6a823355 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2666,7 +2666,7 @@ pub fn symlink_metadata>(path: P) -> io::Result { /// and the `MoveFileExW` or `SetFileInformationByHandle` function on Windows. /// /// Because of this, the behavior when both `from` and `to` exist differs. On -/// Unix, if `from` is a directory, `to` must also be an (empty) directory. If +/// Unix, if `from` is a directory, `to` must either not exist or be an empty directory. If /// `from` is not a directory, `to` must also be not a directory. The behavior /// on Windows is the same on Windows 10 1607 and higher if `FileRenameInfoEx` /// is supported by the filesystem; otherwise, `from` can be anything, but From 86891191f571a12acf7e9b75a410f3d2897775d1 Mon Sep 17 00:00:00 2001 From: sftse Date: Fri, 28 Nov 2025 16:16:57 +0100 Subject: [PATCH 2/3] Update library/std/src/fs.rs Co-authored-by: Marijn Schouten --- library/std/src/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 1950e6a823355..4ce1f4fe95583 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2666,7 +2666,7 @@ pub fn symlink_metadata>(path: P) -> io::Result { /// and the `MoveFileExW` or `SetFileInformationByHandle` function on Windows. /// /// Because of this, the behavior when both `from` and `to` exist differs. On -/// Unix, if `from` is a directory, `to` must either not exist or be an empty directory. If +/// Unix, if `from` is a directory, `to` must be an empty directory or non-existent. If /// `from` is not a directory, `to` must also be not a directory. The behavior /// on Windows is the same on Windows 10 1607 and higher if `FileRenameInfoEx` /// is supported by the filesystem; otherwise, `from` can be anything, but From c5f82158c408fec996844b9761d52b8e82906875 Mon Sep 17 00:00:00 2001 From: sftse Date: Fri, 28 Nov 2025 16:20:05 +0100 Subject: [PATCH 3/3] Update library/std/src/fs.rs Co-authored-by: Marijn Schouten --- library/std/src/fs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 4ce1f4fe95583..b712e2cccda36 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2667,7 +2667,7 @@ pub fn symlink_metadata>(path: P) -> io::Result { /// /// Because of this, the behavior when both `from` and `to` exist differs. On /// Unix, if `from` is a directory, `to` must be an empty directory or non-existent. If -/// `from` is not a directory, `to` must also be not a directory. The behavior +/// `from` is not a directory, `to` must also not be a directory. The behavior /// on Windows is the same on Windows 10 1607 and higher if `FileRenameInfoEx` /// is supported by the filesystem; otherwise, `from` can be anything, but /// `to` must *not* be a directory.