summary refs log tree commit diff
path: root/library/std/src/sys/windows/handle
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-16 08:48:36 +0000
committerbors <bors@rust-lang.org>2022-07-16 08:48:36 +0000
commite092d0b6b43f2de967af0887873151bb1c0b18d3 (patch)
tree3c0903d6cb6800cbf43017141fc38b669a360386 /library/std/src/sys/windows/handle
parenta8314ef7d0ec7b75c336af2c9857bfaf43002bfc (diff)
parent647922f9d8a6f1fa639ab206e60a76d43cc9d3dd (diff)
downloadrust-1.62.1.tar.gz
rust-1.62.1.zip
Auto merge of #99299 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.62.1
[stable] 1.62.1 release

This bundles:

*  Windows: Fallback for overlapped I/O #98950
*  don't succeed evaluate_obligation query if new opaque types were registered #98614
*  Mitigate MMIO stale data vulnerability #98126
*  Return a FxIndexSet in is_late_bound query. #99219

Also bumps the version number to 1.62.1 and includes a short release notes section for the release.

r? `@Mark-Simulacrum`
Diffstat (limited to 'library/std/src/sys/windows/handle')
-rw-r--r--library/std/src/sys/windows/handle/tests.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/library/std/src/sys/windows/handle/tests.rs b/library/std/src/sys/windows/handle/tests.rs
new file mode 100644
index 00000000000..d836dae4c30
--- /dev/null
+++ b/library/std/src/sys/windows/handle/tests.rs
@@ -0,0 +1,22 @@
+use crate::sys::pipe::{anon_pipe, Pipes};
+use crate::{thread, time};
+
+/// Test the synchronous fallback for overlapped I/O.
+#[test]
+fn overlapped_handle_fallback() {
+    // Create some pipes. `ours` will be asynchronous.
+    let Pipes { ours, theirs } = anon_pipe(true, false).unwrap();
+
+    let async_readable = ours.into_handle();
+    let sync_writeable = theirs.into_handle();
+
+    thread::scope(|_| {
+        thread::sleep(time::Duration::from_millis(100));
+        sync_writeable.write(b"hello world!").unwrap();
+    });
+
+    // The pipe buffer starts empty so reading won't complete synchronously unless
+    // our fallback path works.
+    let mut buffer = [0u8; 1024];
+    async_readable.read(&mut buffer).unwrap();
+}