File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -968,14 +968,21 @@ pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> {
968
968
fs_imp:: lstat ( path. as_ref ( ) ) . map ( Metadata )
969
969
}
970
970
971
- /// Rename a file or directory to a new name.
971
+ /// Rename a file or directory to a new name, replacing the original file if
972
+ /// `to` already exists.
972
973
///
973
974
/// This will not work if the new name is on a different mount point.
974
975
///
975
976
/// # Platform-specific behavior
976
977
///
977
978
/// This function currently corresponds to the `rename` function on Unix
978
979
/// and the `MoveFileEx` function with the `MOVEFILE_REPLACE_EXISTING` flag on Windows.
980
+ ///
981
+ /// Because of this, the behavior when both `from` and `to` exist differs. On
982
+ /// Unix, if `from` is a directory, `to` must also be an (empty) directory. If
983
+ /// `from` is not a directory, `to` must also be not a directory. In contrast,
984
+ /// on Windows, `from` can be anything, but `to` must *not* be a directory.
985
+ ///
979
986
/// Note that, this [may change in the future][changes].
980
987
/// [changes]: ../io/index.html#platform-specific-behavior
981
988
///
You can’t perform that action at this time.
0 commit comments