]> git.lizzy.rs Git - rust.git/commitdiff
add test case for rust-lang#39364
authorIbraheem Ahmed <ibraheem@ibraheem.ca>
Mon, 17 Oct 2022 23:12:12 +0000 (19:12 -0400)
committerIbraheem Ahmed <ibraheem@ibraheem.ca>
Thu, 10 Nov 2022 04:20:02 +0000 (23:20 -0500)
library/std/src/sync/mpsc/tests.rs

index f6d0796f604fa9c2a4aa3ad65a202fa9d491a932..82c52eb4fef45b6e2cc48bc4e893e2f08d50ee8d 100644 (file)
@@ -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));
+}