]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #31963 - barosl:rename-doc, r=alexcrichton
authorbors <bors@rust-lang.org>
Tue, 12 Apr 2016 17:12:55 +0000 (10:12 -0700)
committerbors <bors@rust-lang.org>
Tue, 12 Apr 2016 17:12:55 +0000 (10:12 -0700)
Describe more platform-specific behaviors of `std::fs::rename`

I did some tests myself regarding the situation when both `from` and `to` exist, and the results were:

On Linux:

`from` | `to` | Result
---- | ---- | ----
Directory | Directory | Ok
Directory | File | Error
File | Directory | Error
File | File | Ok

On Windows:

`from` | `to` | Result
---- | ---- | ----
Directory | Directory | Error
Directory | File | Ok
File | Directory | Error
File | File | Ok

This is a bit against the official MSDN documentation, which says "(`MOVEFILE_REPLACE_EXISTING`) cannot be used if `lpNewFileName` or `lpExistingFileName` names a directory." As evidenced above, `lpExistingFileName` *can* be a directory.

I also mentioned the atomicity of the operation.

Fixes #31301.

1  2 
src/libstd/fs.rs

Simple merge