about summary refs log tree commit diff
path: root/library/std/src/os/windows
AgeCommit message (Collapse)AuthorLines
2025-09-26Update CURRENT_RUSTC_VERSION post-bumpMark Rousskov-1/+1
2025-09-04Rollup merge of #140459 - niklasf:feature/read-buf-at, r=tgross35Stuart Cook-0/+43
Add `read_buf` equivalents for positioned reads Adds the following items under the ~~`read_buf` (rust-lang/rust#78485)~~ `read_buf_at` (rust-lang/rust#140771) feature: - `std::os::unix::fs::FileExt::read_buf_at` - `std::os::unix::fs::FileExt::read_buf_exact_at` - `std::os::windows::fs::FileExt::seek_read_buf` try-job: `x86_64-msvc*` try-job: `test-various*` try-job: `dist-various*`
2025-09-03Add `read_buf` equivalents for positioned readsNiklas Fiekas-0/+43
Adds the following items under the `read_buf_at` feature: - `std::os::unix::fs::FileExt::read_buf_at` - `std::os::unix::fs::FileExt::read_buf_exact_at` - `std::os::windows::fs::FileExt::seek_read_buf`
2025-08-27Rollup merge of #145335 - clarfonthey:wtf8-core-alloc, r=Mark-SimulacrumMatthias Krüger-4/+34
Move WTF-8 code from std into core and alloc This is basically a small portion of rust-lang/rust#129411 with a smaller scope. It *does not*\* affect any public APIs; this code is still internal to the standard library. It just moves the WTF-8 code into `core` and `alloc` so it can be accessed by `no_std` crates like `backtrace`. > \* The only public API this affects is by adding a `Debug` implementation to `std::os::windows::ffi::EncodeWide`, which was not present before. This is due to the fact that `core` requires `Debug` implementations for all types, but `std` does not (yet) require this. Even though this was ultimately changed to be a wrapper over the original type, not a re-export, I decided to keep the `Debug` implementation so it remains useful. Like we do with ordinary strings, the tests are still located entirely in `alloc`, rather than splitting them into `core` and `alloc`. ---- Reviewer note: for ease of review, this is split into three commits: 1. Moving the original files into their new "locations" 2. Actually modifying the code to compile. 3. Removing aesthetic changes that were made so that the diff for commit 2 was readable. You can review commits 1 and 3 to verify these claims, but commit 2 contains the majority of the changes you should care about. ---- API changes: `impl Debug for std::os::windows::ffi::EncodeWide`
2025-08-20Move WTF-8 code from std to core/allocltdk-4/+34
2025-08-19Fix doc of `std::os::windows::io::BorrowedSocket::borrow_raw`Lorenz Leutgeb-1/+1
A small oversight in 0cb69dec57f I noticed while reading.
2025-05-14wire up startupinfo methodsFederico Terzi-0/+36
2025-04-09replace version placeholderBoxy-12/+12
2025-03-14Mv os-specific trait impl of `Pipe*` into `std::os::*`Jiahao XU-0/+84
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2025-03-11Migrate std to Rust 2024Eric Huss-1/+1
2025-03-06library: Use size_of from the prelude instead of importedThalia Archibald-7/+2
Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the prelude instead of importing or qualifying them. These functions were added to all preludes in Rust 1.80.
2025-02-28Use correct error message casing for `io::const_error`sNoratrieb-1/+1
Error messages are supposed to start with lowercase letters, but a lot of `io::const_error` messages did not. This fixes them to start with a lowercase letter. I did consider adding a const check for this to the macro, but some of them start with proper nouns that make sense to uppercase them. See https://doc.rust-lang.org/1.85.0/std/error/trait.Error.html
2025-02-14Add safe new to NotAllOnesKornel-6/+4
2025-02-08Rustfmtbjorn3-4/+4
2025-02-02std: move network code into `sys`joboet-4/+4
As per #117276, this PR moves `sys_common::net` and the `sys::pal::net` into the newly created `sys::net` module. In order to support #135141, I've moved all the current network code into a separate `connection` module, future functions like `hostname` can live in separate modules. I'll probably do a follow-up PR and clean up some of the actual code, this is mostly just a reorganization.
2025-01-09Update a bunch of library types for MCP807Scott McMurray-25/+14
This greatly reduces the number of places that actually use the `rustc_layout_scalar_valid_range_*` attributes down to just 3: ``` library/core\src\ptr\non_null.rs 68:#[rustc_layout_scalar_valid_range_start(1)] library/core\src\num\niche_types.rs 19: #[rustc_layout_scalar_valid_range_start($low)] 20: #[rustc_layout_scalar_valid_range_end($high)] ``` Everything else -- PAL Nanoseconds, alloc's `Cap`, niched FDs, etc -- all just wrap those `niche_types` types.
2024-12-21Rollup merge of #123604 - michaelvanstraten:proc_thread_attribute_list, ↵Matthias Krüger-55/+273
r=ChrisDenton Abstract `ProcThreadAttributeList` into its own struct As extensively discussed in issue #114854, the current implementation of the unstable `windows_process_extensions_raw_attribute` features lacks support for passing a raw pointer. This PR wants to explore the opportunity to abstract away the `ProcThreadAttributeList` into its own struct to for one improve safety and usability and secondly make it possible to maybe also use it to spawn new threads. try-job: x86_64-mingw
2024-12-15Auto merge of #133223 - zachs18:uniquerc-impls, r=Noratriebbors-0/+16
`UniqueRc` trait impls UniqueRc tracking Issue: #112566 Stable traits: (i.e. impls behind only the `unique_rc_arc` feature gate) * Support the same formatting as `Rc`: * `fmt::Debug` and `fmt::Display` delegate to the pointee. * `fmt::Pointer` prints the address of the pointee. * Add explicit `!Send` and `!Sync` impls, to mirror `Rc`. * Borrowing traits: `Borrow`, `BorrowMut`, `AsRef`, `AsMut` * `Rc` does not implement `BorrowMut` and `AsMut`, but `UniqueRc` can. * Unconditional `Unpin`, like other heap-allocated types. * Comparison traits `(Partial)Ord` and `(Partial)Eq` delegate to the pointees. * `PartialEq for UniqueRc` does not do `Rc`'s specialization shortcut for pointer equality when `T: Eq`, since by definition two `UniqueRc`s cannot share an allocation. * `Hash` delegates to the pointee. * `AsRawFd`, `AsFd`, `AsHandle`, `AsSocket` delegate to the pointee like `Rc`. * Sidenote: The bounds on `T` for the existing `Pointer<T>` impls for specifically `AsRawFd` and `AsSocket` do not allow `T: ?Sized`. For the added `UniqueRc` impls I allowed `T: ?Sized` for all four traits, but I did not change the existing (stable) impls. Unstable traits: * `DispatchFromDyn`, allows using `UniqueRc<Self>` as a method receiver under `feature(arbitrary_self_types)`. * Existing `PinCoerceUnsized for UniqueRc` is generalized to allow non-`Global` allocators, like `Rc`. * `DerefPure`, allows using `UniqueRc` in deref-patterns under `feature(deref_patterns)`, like `Rc`. For documentation, `Rc` only has documentation on the comparison traits' methods, so I copied/adapted the documentation for those, and left the rest without impl-specific docs. ~~Edit: Marked as draft while I figure out `UnwindSafe`.~~ Edit: Ignoring `UnwindSafe` for this PR
2024-11-30Abstract `ProcThreadAttributeList` into its own structMichael van Straten-55/+273
2024-11-26std: update internal uses of `io::const_error!`joboet-1/+1
2024-11-19UniqueRc: platform-specific AsFd/Handle/etc impls to mirror RcZachary S-0/+16
2024-09-11Rollup merge of #130168 - juliusl:pr/fix-win-fs-change-time-links, r=ChrisDentonJubilee-10/+14
maint: update docs for change_time ext and doc links maint: update docs for change_time ext and doc links Related: https://github.com/rust-lang/rust/issues/121478 r? tgross35
2024-09-11chore: remove struct detailsJulius Liu-2/+2
2024-09-11docs: remove struct infoJulius Liu-1/+1
2024-09-09chore: removing supporting links in favor of existing doc-comment styleJulius Liu-13/+6
2024-09-09maint: update docs for change_time ext and doc linksJulius Liu-9/+20
2024-08-03Rollup merge of #127586 - zachs18:more-must-use, r=cuviperMatthias Krüger-0/+2
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-29Reformat `use` declarations.Nicholas Nethercote-20/+7
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-7/+7
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-24Rollup merge of #127733 - GrigorenkoPV:don't-forget, r=AmanieuMatthias Krüger-9/+4
Replace some `mem::forget`'s with `ManuallyDrop` > but I would like to see a larger effort to replace all uses of `mem::forget`. _Originally posted by `@saethlin` in https://github.com/rust-lang/rust/issues/127584#issuecomment-2226087767_ So, r? `@saethlin` Sorry, I have finished writing all of this before I got your response.
2024-07-17feat: adding ext that returns change_time for WindowsJulius Liu-0/+10
2024-07-15lib: replace some `mem::forget`'s with `ManuallyDrop`Pavel Grigorenko-9/+4
2024-07-15Make os/windows default to deny unsafe in unsafeChris Denton-15/+26
2024-07-10Add `must_use` to IntoRawFd/IntoRawSocket/IntoRawHandle's methods.Zachary S-0/+2
2024-07-09Fixed doc linksAndres Olivares-2/+2
2024-07-09Few changes to doc comments. Added tracking issue number.Andres Olivares-4/+5
2024-07-09Exposing STARTUPINFOW.wShowWindow in CommandExt (show_window function) to ↵Andres Olivares-0/+12
control how a new process should display its window (normal, minimized, maximized, etc)
2024-04-09Update documentation related to the recent cmd.exe fixTrevor Gross-17/+32
Fix some grammar nits, change `bat` (extension) -> `batch` (file), and make line wrapping more consistent.
2024-04-09Document Windows argument splittingChris Denton-2/+54
2024-03-14Rollup merge of #119029 - dylni:avoid-closing-invalid-handles, r=ChrisDentonMatthias Krüger-21/+47
Avoid closing invalid handles Documentation for [`HandleOrInvalid`] has this note: > If holds a handle other than `INVALID_HANDLE_VALUE`, it will close the handle on drop. Documentation for [`HandleOrNull`] has this note: > If this holds a non-null handle, it will close the handle on drop. Currently, both will call `CloseHandle` on their invalid handles as a result of using `OwnedHandle` internally, contradicting the above paragraphs. This PR adds destructors that match the documentation. ```@rustbot``` label A-io O-windows T-libs [`HandleOrInvalid`]: https://doc.rust-lang.org/std/os/windows/io/struct.HandleOrInvalid.html [`HandleOrNull`]: https://doc.rust-lang.org/std/os/windows/io/struct.HandleOrNull.html
2024-03-09Rollup merge of #121711 - ChrisDenton:junction, r=Mark-SimulacrumGuillaume Boisseau-0/+12
Implement junction_point Implements https://github.com/rust-lang/rust/issues/121709 We already had a private implementation that we use for tests so we could just make that public. Except it was very hacky as it was only ever intended for use in testing. I've made an improved version that at least handles path conversion correctly and has less need for things like the `Align8` hack. There's still room for further improvement though.
2024-03-09Rollup merge of #114655 - nbdd0121:io-safety, r=dtolnayGuillaume Boisseau-5/+5
Make `impl<Fd: AsFd>` impl take `?Sized` `@rustbot` labels: +T-libs-api +needs-fcp
2024-03-09Avoid closing invalid handlesdylni-21/+47
2024-02-27Implement junction_pointChris Denton-0/+12
2024-02-11Rollup merge of #120459 - rytheo:handle-conversion-docs, r=Mark-SimulacrumMatthias Krüger-0/+11
Document various I/O descriptor/handle conversions Related to #51430
2024-02-04Document various I/O handle conversionsRyan Lowe-0/+11
2024-01-28Make `impl<T: AsHandle>` impl take `?Sized`Gary Guo-5/+5
2024-01-28std: Update documentation of seek_write on WindowsAlex Crichton-1/+1
Currently the documentation of `FileExt::seek_write` on Windows indicates that writes beyond the end of the file leave intermediate bytes uninitialized. This commentary dates back to the original inclusion of these functions in #35704 (wow blast from the past!). At the time the functionality here was implemented using `WriteFile`, but nowadays the `NtWriteFile` method is used instead. The documentation for `NtWriteFile` explicitly states: > If Length and ByteOffset specify a write operation past the current > end-of-file mark, NtWriteFile automatically extends the file and updates > the end-of-file mark; any bytes that are not explicitly written between > such old and new end-of-file marks are defined to be zero. This commentary has had a downstream impact in the `system-interface` crate where it tries to handle this by explicitly writing zeros, but I don't believe that's necessary any more. I'm sending a PR upstream here to avoid future confusion and codify that zeros are written in the intermediate bytes matching what Windows currently provides.
2023-11-23Fix tracking issue of Windows ExitCodeExtDavid Tolnay-3/+3
2023-11-22unnecessary_mut_passedChris Denton-2/+2
This is where our Windows API bindings previously (and incorrectly) used `*mut` instead of `*const` pointers. Now that the bindings have been corrected, the mutable references (which auto-convert to `*mut`) are unnecessary and we can use shared references.