about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorIbraheem Ahmed <ibraheem@ibraheem.ca>2022-10-17 19:12:12 -0400
committerIbraheem Ahmed <ibraheem@ibraheem.ca>2022-11-09 23:20:02 -0500
commit8a68b40432638e6fa8deee85c9fef9aefc66b006 (patch)
treee5f2418ffa2005a077da5a443ef33acc3edf6437 /library/std/src
parent31dc5bba8993e7958187221aec7af9adf902c64a (diff)
downloadrust-8a68b40432638e6fa8deee85c9fef9aefc66b006.tar.gz
rust-8a68b40432638e6fa8deee85c9fef9aefc66b006.zip
add test case for rust-lang#39364
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/sync/mpsc/tests.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/library/std/src/sync/mpsc/tests.rs b/library/std/src/sync/mpsc/tests.rs
index f6d0796f604..82c52eb4fef 100644
--- a/library/std/src/sync/mpsc/tests.rs
+++ b/library/std/src/sync/mpsc/tests.rs
@@ -706,3 +706,17 @@ fn issue_32114() {
     let _ = tx.send(123);
     assert_eq!(tx.send(123), Err(SendError(123)));
 }
+
+#[test]
+fn issue_39364() {
+    let (tx, rx) = channel::<()>();
+    let t = thread::spawn(move || {
+        thread::sleep(Duration::from_millis(300));
+        let _ = tx.clone();
+        crate::mem::forget(tx);
+    });
+
+    let _ = rx.recv_timeout(Duration::from_millis(500));
+    t.join().unwrap();
+    let _ = rx.recv_timeout(Duration::from_millis(500));
+}