summary refs log tree commit diff
path: root/library/std/src/os/windows/io
AgeCommit message (Collapse)AuthorLines
2021-11-15Document the valid values for `HandleOrNull` and `HandleOrInvalid`.Dan Gohman-0/+8
(cherry picked from commit 5d79870aec85d2a2e15b9cac808cae21b5bcbce9)
2021-11-15Fix Windows compilation errors.Dan Gohman-11/+6
(cherry picked from commit e102c2a3f2d25fdee6793b45b1d12e14f0c16f93)
2021-11-15Fix assertion failures in `OwnedHandle` with `windows_subsystem`.Dan Gohman-40/+72
As discussed in #88576, raw handle values in Windows can be null, such as in `windows_subsystem` mode, or when consoles are detached from a process. So, don't use `NonNull` to hold them, don't assert that they're not null, and remove `OwnedHandle`'s `repr(transparent)`. Introduce a new `HandleOrNull` type, similar to `HandleOrInvalid`, to cover the FFI use case. (cherry picked from commit 3b974813871a4dee6cac3128a4e3fa5e81125464)
2021-08-19Fix doc test failures on Windows.Dan Gohman-1/+2
2021-08-19Rename OptionFileHandle to HandleOrInvalid and make it just wrap an ↵Dan Gohman-79/+37
Option<OwnedHandle> The name (and updated documentation) make the FFI-only usage clearer, and wrapping Option<OwnedHandle> avoids the need to write a separate Drop or Debug impl. Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-08-19Don't encourage migration until io_safety is stablized.Dan Gohman-4/+4
2021-08-19Add more comments about the `INVALID_HANDLE_VALUE` situation.Dan Gohman-12/+30
2021-08-19Add Safety comments to the `As*` for `Owned*` implementations.Dan Gohman-0/+6
2021-08-19Rename `OwnedFd`'s private field to match it's debug output.Dan Gohman-51/+52
2021-08-19Delete a spurious empty comment line.Dan Gohman-1/+0
2021-08-19Add a comment about how `OwnedHandle` should not be used with registry handles.Dan Gohman-2/+15
2021-08-19Add a comment about `OptionFileHandle`.Dan Gohman-0/+4
2021-08-19Update library/std/src/os/windows/io/socket.rsDan Gohman-1/+1
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-08-19Update library/std/src/os/windows/io/handle.rsDan Gohman-1/+1
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-08-19I/O safety.Dan Gohman-0/+895
Introduce `OwnedFd` and `BorrowedFd`, and the `AsFd` trait, and implementations of `AsFd`, `From<OwnedFd>` and `From<T> for OwnedFd` for relevant types, along with Windows counterparts for handles and sockets. Tracking issue: - <https://github.com/rust-lang/rust/issues/87074> RFC: - <https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md>