about summary refs log tree commit diff
path: root/library/std/src/os/windows/io/mod.rs
diff options
context:
space:
mode:
authorDan Gohman <dev@sunfishcode.online>2022-05-11 07:17:52 -0700
committerDan Gohman <dev@sunfishcode.online>2022-05-11 07:26:49 -0700
commit90ff6fcd4ec4a91b9d0a4956d3fd8459931f2de4 (patch)
tree1658c667bcc8a8245c9d24d591cbc4c74e35fb11 /library/std/src/os/windows/io/mod.rs
parentecd44958e0a21110d09862ee080d95a4ca6c52f8 (diff)
downloadrust-90ff6fcd4ec4a91b9d0a4956d3fd8459931f2de4.tar.gz
rust-90ff6fcd4ec4a91b9d0a4956d3fd8459931f2de4.zip
Add rustc_nonnull_optimization_guaranteed to Owned/Borrowed Fd/Socket
PR #94586 added support for using
`rustc_nonnull_optimization_guaranteed` on values where the "null" value
is the all-ones bitpattern.

Now that #94586 has made it to the stage0 compiler, add
`rustc_nonnull_optimization_guaranteed` to `OwnedFd`, `BorrowedFd`,
`OwnedSocket`, and `BorrowedSocket`, since these types all exclude
all-ones bitpatterns.

This allows `Option<OwnedFd>`, `Option<BorrowedFd>`, `Option<OwnedSocket>`,
and `Option<BorrowedSocket>` to be used in FFI declarations, as described
in the [I/O safety RFC].

[I/O safety RFC]: https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md#ownedfd-and-borrowedfdfd-1
Diffstat (limited to 'library/std/src/os/windows/io/mod.rs')
-rw-r--r--library/std/src/os/windows/io/mod.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/os/windows/io/mod.rs b/library/std/src/os/windows/io/mod.rs
index 2f6f0769548..3325688e661 100644
--- a/library/std/src/os/windows/io/mod.rs
+++ b/library/std/src/os/windows/io/mod.rs
@@ -54,3 +54,6 @@ pub use handle::*;
 pub use raw::*;
 #[unstable(feature = "io_safety", issue = "87074")]
 pub use socket::*;
+
+#[cfg(test)]
+mod tests;