Skip to content

Commit da3f5b8

Browse files
authored
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.
2 parents 9d4b462 + 4259ae6 commit da3f5b8

File tree

1 file changed

+4
-3
lines changed
  • src/libstd/sys/redox

1 file changed

+4
-3
lines changed

src/libstd/sys/redox/fs.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,10 @@ pub fn unlink(p: &Path) -> io::Result<()> {
383383
Ok(())
384384
}
385385

386-
pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
387-
::sys_common::util::dumb_print(format_args!("Rename\n"));
388-
unimplemented!();
386+
pub fn rename(old: &Path, new: &Path) -> io::Result<()> {
387+
copy(old, new)?;
388+
unlink(old)?;
389+
Ok(())
389390
}
390391

391392
pub fn set_perm(p: &Path, perm: FilePermissions) -> io::Result<()> {

0 commit comments

Comments
 (0)