diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2025-03-06 14:18:18 +0000 |
|---|---|---|
| committer | Chris Denton <chris@chrisdenton.dev> | 2025-03-07 17:51:56 +0000 |
| commit | 3cb53df1feaba73b84344c8c0e3dc4120ad8c95b (patch) | |
| tree | dae1469a51c1521dd16d6c560d3f81886385993c /library/std/src | |
| parent | 0dfe2ae3fb72c50ea369286131c73daede13d7e5 (diff) | |
| download | rust-3cb53df1feaba73b84344c8c0e3dc4120ad8c95b.tar.gz rust-3cb53df1feaba73b84344c8c0e3dc4120ad8c95b.zip | |
Return OutOfMemoryError and update docs
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/fs.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/pal/windows/fs.rs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 4314c8a0b18..46b5860123f 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2446,7 +2446,7 @@ pub fn symlink_metadata<P: AsRef<Path>>(path: P) -> io::Result<Metadata> { /// # Platform-specific behavior /// /// This function currently corresponds to the `rename` function on Unix -/// and the `SetFileInformationByHandle` function on Windows. +/// and the `MoveFileExW` or `SetFileInformationByHandle` function on Windows. /// /// Because of this, the behavior when both `from` and `to` exist differs. On /// Unix, if `from` is a directory, `to` must also be an (empty) directory. If diff --git a/library/std/src/sys/pal/windows/fs.rs b/library/std/src/sys/pal/windows/fs.rs index 34108e44d58..8fce0496d80 100644 --- a/library/std/src/sys/pal/windows/fs.rs +++ b/library/std/src/sys/pal/windows/fs.rs @@ -1,6 +1,6 @@ use super::api::{self, WinError, set_file_information_by_handle}; use super::{IoResult, to_u16s}; -use crate::alloc::{Layout, alloc, dealloc, handle_alloc_error}; +use crate::alloc::{Layout, alloc, dealloc}; use crate::borrow::Cow; use crate::ffi::{OsStr, OsString, c_void}; use crate::io::{self, BorrowedCursor, Error, IoSlice, IoSliceMut, SeekFrom}; @@ -1269,7 +1269,7 @@ pub fn rename(old: &Path, new: &Path) -> io::Result<()> { unsafe { file_rename_info = alloc(layout).cast::<c::FILE_RENAME_INFO>(); if file_rename_info.is_null() { - handle_alloc_error(layout); + return Err(io::ErrorKind::OutOfMemory.into()); } (&raw mut (*file_rename_info).Anonymous).write(c::FILE_RENAME_INFO_0 { |
