about summary refs log tree commit diff
path: root/src/libstd/sys/redox
diff options
context:
space:
mode:
authorSteve Klabnik <steve@steveklabnik.com>2017-07-13 10:45:22 -0400
committerGitHub <noreply@github.com>2017-07-13 10:45:22 -0400
commitda3f5b80ed8a0fb88aae2d2a462acc97b05ba911 (patch)
treed79dcef1bcd5099dfe9617ac181dcbbc0baba97b /src/libstd/sys/redox
parent9d4b46225073c25770200082e5d71718d9afadaf (diff)
parent4259ae64755f3b72296b95a9eeabaf883321069b (diff)
downloadrust-da3f5b80ed8a0fb88aae2d2a462acc97b05ba911.tar.gz
rust-da3f5b80ed8a0fb88aae2d2a462acc97b05ba911.zip
Rollup merge of #43204 - jackpot51:patch-3, r=alexcrichton
Implement fs::rename in sys::redox

This uses a simple implementation of copy + unlink. Redox does not have a rename or link system call for a faster implementation.
Diffstat (limited to 'src/libstd/sys/redox')
-rw-r--r--src/libstd/sys/redox/fs.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libstd/sys/redox/fs.rs b/src/libstd/sys/redox/fs.rs
index 87e50c40148..918893097f8 100644
--- a/src/libstd/sys/redox/fs.rs
+++ b/src/libstd/sys/redox/fs.rs
@@ -383,9 +383,10 @@ pub fn unlink(p: &Path) -> io::Result<()> {
     Ok(())
 }
 
-pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
-    ::sys_common::util::dumb_print(format_args!("Rename\n"));
-    unimplemented!();
+pub fn rename(old: &Path, new: &Path) -> io::Result<()> {
+    copy(old, new)?;
+    unlink(old)?;
+    Ok(())
 }
 
 pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> {