{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/31301","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/31301/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/31301/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/31301/events","html_url":"https://github.com/rust-lang/rust/issues/31301","id":129943918,"number":31301,"title":"fs::rename fails when dest exists only on windows","user":{"login":"brson","id":147214,"avatar_url":"https://avatars.githubusercontent.com/u/147214?v=3","gravatar_id":"","url":"https://api.github.com/users/brson","html_url":"https://github.com/brson","followers_url":"https://api.github.com/users/brson/followers","following_url":"https://api.github.com/users/brson/following{/other_user}","gists_url":"https://api.github.com/users/brson/gists{/gist_id}","starred_url":"https://api.github.com/users/brson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brson/subscriptions","organizations_url":"https://api.github.com/users/brson/orgs","repos_url":"https://api.github.com/users/brson/repos","events_url":"https://api.github.com/users/brson/events{/privacy}","received_events_url":"https://api.github.com/users/brson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-windows","name":"A-windows","color":"d7e102"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-wrong","name":"I-wrong","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-01-30T05:33:33Z","updated_at":"2016-01-30T09:17:18Z","closed_at":null,"body":"This code fails on windows, not on linux:\r\n\r\n```\r\nuse std::fs;\r\n\r\nfn main() {\r\n    let src = \"testdir1\";\r\n    let dest = \"testdir2\";\r\n    fs::create_dir(src).unwrap();\r\n    fs::create_dir(dest).unwrap();\r\n    fs::rename(src, dest).unwrap();\r\n}\r\n```\r\n\r\nwith\r\n\r\n```\r\nthread '<main>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Os { code: 5, message: \"Access is denied.\" } }', ../src/libcore\\result.rs:741\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/177117325","html_url":"https://github.com/rust-lang/rust/issues/31301#issuecomment-177117325","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/31301","id":177117325,"user":{"login":"retep998","id":666308,"avatar_url":"https://avatars.githubusercontent.com/u/666308?v=3","gravatar_id":"","url":"https://api.github.com/users/retep998","html_url":"https://github.com/retep998","followers_url":"https://api.github.com/users/retep998/followers","following_url":"https://api.github.com/users/retep998/following{/other_user}","gists_url":"https://api.github.com/users/retep998/gists{/gist_id}","starred_url":"https://api.github.com/users/retep998/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/retep998/subscriptions","organizations_url":"https://api.github.com/users/retep998/orgs","repos_url":"https://api.github.com/users/retep998/repos","events_url":"https://api.github.com/users/retep998/events{/privacy}","received_events_url":"https://api.github.com/users/retep998/received_events","type":"User","site_admin":false},"created_at":"2016-01-30T09:17:18Z","updated_at":"2016-01-30T09:17:18Z","body":"Maybe std should expose an option to allow overwriting the destination. Interestingly, the option `MOVEFILE_REPLACE_EXISTING` states `This value cannot be used if lpNewFileName or lpExistingFileName names a directory.` so even with that you wouldn't be able to overwrite an existing directory."}}