about summary refs log tree commit diff
path: root/library/std/src/sys/pal/windows
AgeCommit message (Collapse)AuthorLines
2024-11-04Fix and undeprecate home_dir()Kornel-2/+2
2024-11-02Fix type reference in documents which was being confused with html tags.Houtamelo-1/+1
2024-10-29Win: rename: Use offset_of! in struct size calculationGeorge Tokmaji-4/+7
2024-10-25library: consistently use American spelling for 'behavior'Ralf Jung-7/+7
2024-10-20fix docsklensy-6/+6
2024-10-20replace FindFirstFileW with FindFirstFileExW and apply optimizationklensy-4/+25
2024-10-20replace FindFirstFileW with FindFirstFileExW and regenerate bindingsklensy-3/+9
2024-10-19Support lock() and lock_shared() on async IO FilesChristopher Berner-13/+49
2024-10-17Abstract the state type for futexesPaul Menage-15/+20
In the same way that we expose SmallAtomic and SmallPrimitive to allow Windows to use a value other than an AtomicU32 for its futex state, this patch switches the primary futex state type from AtomicU32 to futex::Atomic. The futex::Atomic type should be usable as an atomic value with underlying primitive type equal to futex::Primitive. This allows supporting the futex API on systems where the underlying kernel futex implementation requires more state than simply an AtomicU32. All in-tree futex implementations simply define {Atomic,Primitive} directly as {AtomicU32,u32}.
2024-10-17Win: Remove special casing of the win7 target for `std::fs::rename`George Tokmaji-14/+1
2024-10-14Fix two const-hacksGeorge Bateman-15/+4
2024-10-13Implement file_lock featureChristopher Berner-0/+97
This adds lock(), lock_shared(), try_lock(), try_lock_shared(), and unlock() to File gated behind the file_lock feature flag
2024-10-13remove outdated comment now that Miri is on CIRalf Jung-1/+0
2024-10-13sys/windows: remove miri hack that is only needed for win7Ralf Jung-7/+3
2024-10-05Stabilize `std::io::ErrorKind::QuotaExceeded`Pavel Grigorenko-2/+2
Also drop "Filesystem" from its name
2024-09-30Win: Use `FILE_RENAME_FLAG_POSIX_SEMANTICS` for `std::fs::rename` if availableGeorge Tokmaji-1/+163
Windows 10 1601 introduced `FileRenameInfoEx` as well as `FILE_RENAME_FLAG_POSIX_SEMANTICS`, allowing for atomic renaming. If it isn't supported, we fall back to `FileRenameInfo`. This commit also replicates `MoveFileExW`'s behavior of checking whether the source file is a mount point and moving the mount point instead of resolving the target path.
2024-09-25Use `&raw` in the standard libraryJosh Stone-29/+24
Since the stabilization in #127679 has reached stage0, 1.82-beta, we can start using `&raw` freely, and even the soft-deprecated `ptr::addr_of!` and `ptr::addr_of_mut!` can stop allowing the unstable feature. I intentionally did not change any documentation or tests, but the rest of those macro uses are all now using `&raw const` or `&raw mut` in the standard library.
2024-09-23std: implement the `random` featurejoboet-32/+4
Implements the ACP https://github.com/rust-lang/libs-team/issues/393.
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-26/+26
2024-09-18Rollup merge of #129934 - ChrisDenton:remove-dir-all3, r=AmanieuJubilee-3/+12
Win: Open dir for sync access in remove_dir_all A small follow up to #129800. We should explicitly open directories for synchronous access. We ultimately use `GetFileInformationByHandleEx` to read directories which should paper over any issues caused by using async directory reads (or else return an error) but it's better to do the right thing in the first place. Note though that `delete` does not read or write any data so it's not necessary there.
2024-09-12Rollup merge of #130101 - RalfJung:const-cleanup, r=fee1-deadMatthias Krüger-1/+1
some const cleanup: remove unnecessary attributes, add const-hack indications I learned that we use `FIXME(const-hack)` on top of the "const-hack" label. That seems much better since it marks the right place in the code and moves around with the code. So I went through the PRs with that label and added appropriate FIXMEs in the code. IMO this means we can then remove the label -- Cc ``@rust-lang/wg-const-eval.`` I also noticed some const stability attributes that don't do anything useful, and removed them. r? ``@fee1-dead``
2024-09-11Rollup merge of #130207 - GrigorenkoPV:ERROR_CANT_RESOLVE_FILENAME, ↵Matthias Krüger-0/+1
r=ChrisDenton Map `ERROR_CANT_RESOLVE_FILENAME` to `ErrorKind::FilesystemLoop` cc #86442 As summarized in #130188, there seems to be a consensus that this should be done.
2024-09-11Map `ERROR_CANT_RESOLVE_FILENAME` to `ErrorKind::FilesystemLoop`Pavel Grigorenko-0/+1
2024-09-11Map `WSAEDQUOT` to `ErrorKind::FilesystemQuotaExceeded`Pavel Grigorenko-0/+1
2024-09-08add FIXME(const-hack)Ralf Jung-1/+1
2024-09-03Win: Open dir for sync access in remove_dir_allChris Denton-3/+12
2024-09-03More robust extension checkingChris Denton-6/+19
2024-08-31Move remove_dir_all impl into a moduleChris Denton-169/+253
2024-08-28Rollup merge of #129378 - goffrie:patch-3, r=ChrisDentonJubilee-13/+9
Clean up cfg-gating of ProcessPrng extern This removes a bit of duplication and is consistent with how `api-ms-win-core-synch-l1-2-0` externs are imported.
2024-08-27std: move allocators to `sys`joboet-272/+0
2024-08-23Rollup merge of #127623 - lolbinarycat:fix_remove_dir_all, r=AmanieuMatthias Krüger-2/+2
fix: fs::remove_dir_all: treat internal ENOENT as success fixes #127576 try-job: test-various
2024-08-22fix: fs::remove_dir_all: treat ENOENT as successbinarycat-2/+2
fixes #127576 windows implementation still needs some work
2024-08-21formatGeoffry Song-9/+2
2024-08-21Clean up cfg-gating of ProcessPrng externGeoffry Song-13/+16
2024-08-09Add windows-targets crate to std's sysrootChris Denton-41/+1
2024-08-03Rollup merge of #128368 - nnethercote:rustfmt-tweaks, r=cuviperMatthias Krüger-0/+1
Formatting tweaks Some small post-#125443 formatting tweaks. r? ``@cuviper``
2024-08-03Rollup merge of #127586 - zachs18:more-must-use, r=cuviperMatthias Krüger-3/+3
Add `#[must_use]` to some `into_raw*` functions. cc #121287 r? ``@cuviper`` Adds `#[must_use = "losing the pointer will leak memory"]`[^1] to `Box::into_raw(_with_allocator)`, `Vec::into_raw_parts(_with_alloc)`, `String::into_raw_parts`[^2], and `rc::{Rc, Weak}::into_raw_with_allocator` (Rc's normal `into_raw` and all of `Arc`'s `into_raw*`s are already `must_use`). Adds `#[must_use = "losing the raw <resource name may leak resources"]` to `IntoRawFd::into_raw_fd`, `IntoRawSocket::into_raw_socket`, and `IntoRawHandle::into_raw_handle`. [^1]: "*will* leak memory" may be too-strong wording (since `Box`/`Vec`/`String`/`rc::Weak` might not have a backing allocation), but I left it as-is for simplicity and consistency. [^2]: `String::into_raw_parts`'s `must_use` message is changed from the previous (possibly misleading) "`self` will be dropped if the result is not used".
2024-07-30Move Windows implementation of anon pipeChris Denton-17/+0
2024-07-30Insert some blank lines.Nicholas Nethercote-0/+1
After things that are immediately followed by a `use` declaration and look like they might apply to that `use` item but actually don't.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-94/+54
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-26Fix doc nitsJohn Arundel-3/+3
Many tiny changes to stdlib doc comments to make them consistent (for example "Returns foo", rather than "Return foo", per RFC1574), adding missing periods, paragraph breaks, backticks for monospace style, and other minor nits. https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md#appendix-a-full-conventions-text
2024-07-25fix: compilation issue w/ refactored typeJulius Liu-2/+2
2024-07-25Rollup merge of #127999 - ChrisDenton:arm32, r=AmanieuMatthias Krüger-41/+26
Inject arm32 shims into Windows metadata generation I had been keen to eventually move to using windows-sys as a normal Cargo dependency. But for linking, compile times and other reasons that's unlikely to ever happen. So if we're sticking with generated bindings then injecting any necessary missing type definitions (i.e. for the MS unsupported arm32) is simpler than defining whole functions ourselves just because we need to manually implement those types on a tier 3 platform. This also reduces the places we need to change when making changes to how we use `#[link]`. r? libs
2024-07-24Forbid unsafe_op_in_unsafe_fn in sys/pal/windowsChris Denton-10/+14
2024-07-24Import `core::ffi::c_void` in more placesChris Denton-22/+21
2024-07-24Rollup merge of #128092 - ChrisDenton:wrappers, r=workingjubileeMatthias Krüger-126/+43
Remove wrapper functions from c.rs I'd like for the windows `c.rs` just to contain the basic platform definitions and not anything higher level unless absolutely necessary. So this removes some wrapper functions that weren't really necessary in any case. The functions are only used in a few places which themselves are relatively thin wrappers. The "interesting" bit is that we had an `AlertableIoFn` that abstracted over `ReadFileEx` and `WriteFileEx`. I've replaced this with a closure. Also I removed an `#[allow(unsafe_op_in_unsafe_fn)]` while I was moving things around.
2024-07-24Auto merge of #127153 - NobodyXu:pipe, r=ChrisDentonbors-3/+30
Initial implementation of anonymous_pipe API ACP completed in rust-lang/libs-team#375 Tracking issue: #127154 try-job: x86_64-msvc try-job: i686-mingw
2024-07-23Initial implementation of anonymous_pipeJiahao XU-3/+30
Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com> Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com> Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-07-23Remove wrapper functions from c.rsChris Denton-126/+43
2024-07-20Rollup merge of #127734 - ChrisDenton:netc, r=Mark-SimulacrumMatthias Krüger-109/+109
Windows: move BSD socket shims to netc On Windows we need to alter a few types so that they can be used in the cross-platform socket code. Currently these alterations are spread throughout the `c` module with some more in the `netc` module. Let's gather all our BSD compatibility shims in the `netc` module so it's all in one place and easier to discover.