about summary refs log tree commit diff
path: root/library/std/src/sys/pal/windows
AgeCommit message (Collapse)AuthorLines
2024-07-20Inject win arm32 shims into metadata generationChris Denton-41/+26
2024-07-17feat: adding ext that returns change_time for WindowsJulius Liu-0/+11
2024-07-17Rollup merge of #127813 - ChrisDenton:win-futex, r=joboetTrevor Gross-4/+7
Prevent double reference in generic futex In the Windows futex implementation we were a little lax at allowing references to references (i.e. `&&`) which can lead to deadlocks due to reading the wrong memory address. This uses a trait to tighten the constraints and ensure this doesn't happen. r? libs
2024-07-17Rollup merge of #127763 - ChrisDenton:safe-unsafe-unsafe, r=tgross35Trevor Gross-87/+107
Make more Windows functions `#![deny(unsafe_op_in_unsafe_fn)]` As part of #127747, I've evaluated some more Windows functions and added `unsafe` blocks where necessary. Some are just trivial wrappers that "inherit" the full unsafety of their function, but for others I've added some safety comments. A few functions weren't actually unsafe at all. I think they were just using `unsafe fn` to avoid an `unsafe {}` block. I'm not touching `c.rs` yet because that is partially being addressed by another PR and also I have plans to further reduce the number of wrapper functions we have in there. r? libs
2024-07-17Prevent double reference in generic futexChris Denton-4/+7
2024-07-17Narrow the scope of the ReadFile unsafe blockChris Denton-11/+12
2024-07-16Add unsafe blocks in unsafe Thread::newChris Denton-13/+17
2024-07-16Remove `slice_to_end`Chris Denton-18/+13
2024-07-16Use futex.rs for Windows thread parkingChris Denton-0/+5
2024-07-15allow(unsafe_op_in_unsafe_fn) on some functionsChris Denton-3/+6
These need to get their safety story straight
2024-07-15Some Windows functions are safeChris Denton-23/+25
2024-07-15Deny more windows unsafe_op_in_unsafe_fnChris Denton-45/+60
2024-07-15Windows: move BSD socket shims to netcChris Denton-109/+109
2024-07-15Rollup merge of #127750 - ChrisDenton:safe-unsafe-unsafe, r=workingjubileeJubilee-10/+25
Make os/windows and pal/windows default to `#![deny(unsafe_op_in_unsafe_fn)]` This is to prevent regressions in modules that currently pass. I did also fix up a few trivial places where the module contained only one or two simple wrappers. In more complex cases we should try to ensure the `unsafe` blocks are appropriately scoped and have any appropriate safety comments. This does not fix the windows bits of #127747 but it should help prevent regressions until that is done and also make it more obvious specifically which modules need attention.
2024-07-15Move safety comment outside unsafe blockChris Denton-1/+1
2024-07-15Make pal/windows default to deny unsafe in unsafeChris Denton-11/+26
2024-07-15Fix Windows 7Chris Denton-4/+4
2024-07-15Don't re-export `c_int` from `c`Chris Denton-8/+7
2024-07-15Remove DWORDChris Denton-88/+77
2024-07-15Remove ULONGChris Denton-14/+13
2024-07-15Remove PSRWLOCKChris Denton-3/+0
2024-07-15Remove LPVOIDChris Denton-12/+10
2024-07-15Remove LPSECURITY_ATTRIBUTESChris Denton-3/+2
2024-07-15Remove LPOVERLAPPEDChris Denton-2/+1
2024-07-15Remove LPCVOIDChris Denton-2/+1
2024-07-15Remove SIZE_TChris Denton-3/+2
2024-07-15Remove CHARChris Denton-4/+3
As with USHORT, keep using C types for BSD socket APIs.
2024-07-15Remove USHORTChris Denton-4/+3
We stick to C types in for socket and address as these are at least nominally BSD-ish and they're used outside of pal/windows in general *nix code
2024-07-15Remove LPWSTRChris Denton-10/+8
2024-07-15Remove UINTChris Denton-2/+1
2024-07-15Remove LONGChris Denton-4/+2
2024-07-15Remove LARGE_INTEGERChris Denton-16/+15
2024-07-15Remove NonZeroDWORDChris Denton-5/+3
2024-07-13Rollup merge of #127370 - ChrisDenton:win-sys, r=Mark-SimulacrumJubilee-67/+77
Windows: Add experimental support for linking std-required system DLLs using raw-dylib For Windows, this allows std to define system imports without needing the user to have import libraries. It's intended for this to become the default. For now it's an experimental feature so it can be tested using build-std.
2024-07-10Explicitly ignore `into_raw_handle()` using `let _ =` in sys/pal/windows.Zachary S-3/+3
2024-07-09Exposing STARTUPINFOW.wShowWindow in CommandExt (show_window function) to ↵Andres Olivares-0/+10
control how a new process should display its window (normal, minimized, maximized, etc)
2024-07-05Add experimental raw-dylib feature to stdChris Denton-0/+13
For Windows, this allows defining imports without needing the user to have import libraries. It's intended for this to become the default.
2024-07-05Use windows_targets macro for allocChris Denton-67/+64
2024-07-04Add comments to windows_targets.rsChris Denton-0/+9
2024-07-04Update windows-bindgen to 0.58.0Chris Denton-851/+153
2024-07-02chore: remove duplicate wordshattizai-1/+1
2024-06-24Rollup merge of #125082 - kpreid:const-uninit, r=dtolnayMichael Goulet-1/+1
Remove `MaybeUninit::uninit_array()` and replace it with inline const blocks. \[This PR originally contained the changes in #125995 too. See edit history for the original PR description.] The documentation of `MaybeUninit::uninit_array()` says: > Note: in a future Rust version this method may become unnecessary when Rust allows [inline const expressions](https://github.com/rust-lang/rust/issues/76001). The example below could then use `let mut buf = [const { MaybeUninit::<u8>::uninit() }; 32];`. The PR adding it also said: <https://github.com/rust-lang/rust/pull/65580#issuecomment-544200681> > if it’s stabilized soon enough maybe it’s not worth having a standard library method that will be replaceable with `let buffer = [MaybeUninit::<T>::uninit(); $N];` That time has come to pass — inline const expressions are stable — so `MaybeUninit::uninit_array()` is now unnecessary. The only remaining question is whether it is an important enough *convenience* to keep it around. I believe it is net good to remove this function, on the principle that it is better to compose two orthogonal features (`MaybeUninit` and array construction) than to have a specific function for the specific combination, now that that is possible.
2024-06-24Replace `MaybeUninit::uninit_array()` with array repeat expression.Kevin Reid-1/+1
This is possible now that inline const blocks are stable; the idea was even mentioned as an alternative when `uninit_array()` was added: <https://github.com/rust-lang/rust/pull/65580#issuecomment-544200681> > if it’s stabilized soon enough maybe it’s not worth having a > standard library method that will be replaceable with > `let buffer = [MaybeUninit::<T>::uninit(); $N];` Const array repetition and inline const blocks are now stable (in the next release), so that circumstance has come to pass, and we no longer have reason to want `uninit_array()` other than convenience. Therefore, let’s evaluate the inconvenience by not using `uninit_array()` in the standard library, before potentially deleting it entirely.
2024-06-24Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrumbors-417/+1
std: refactor the TLS implementation As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. `@rustbot` label +A-thread-locals
2024-06-22Rollup merge of #126140 - eduardosm:stabilize-fs_try_exists, r=AmanieuMatthias Krüger-1/+1
Rename `std::fs::try_exists` to `std::fs::exists` and stabilize fs_try_exists FCP completed in tracking issue. Tracking issue: https://github.com/rust-lang/rust/issues/83186 Closes https://github.com/rust-lang/rust/issues/83186 Stabilized API: ```rust mod fs { pub fn exists<P: AsRef<Path>>(path: P) -> io::Result<bool>; } ```
2024-06-15Rollup merge of #126229 - ChrisDenton:bindgen, r=Mark-SimulacrumGuillaume Gomez-417/+66
Bump windows-bindgen to 0.57 This PR updates our generated Windows API bindings using the latest version of `windows-bindgen`. The only change to the generated code is that `derive` is used for `Copy` and `Clone` instead of `impl`.
2024-06-15std: refactor the TLS implementationjoboet-417/+1
As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. @rustbot label +A-thread-locals
2024-06-12Update a cranelift patch file for formatting changes.Nicholas Nethercote-2/+2
PR #125443 will reformat all the use declarations in the repo. This would break a patch kept in `rustc_codegen_cranelift` that gets applied to `library/std/src/sys/pal/windows/rand.rs`. So this commit formats the use declarations in `library/std/src/sys/pal/windows/rand.rs` in advance of #125443 and updates the patch file accordingly. The motivation is that #125443 is a huge change and we want to get fiddly little changes like this out of the way so it can be nothing more than an `x fmt --all`.
2024-06-11Rename `std::fs::try_exists` to `std::fs::exists` and stabilize fs_try_existsEduardo Sánchez Muñoz-1/+1
2024-06-10Bump windows-bindgen to 0.57Chris Denton-417/+66