avoid memory leak in mpsc test

This commit is contained in:
Ralf Jung 2022-11-14 13:38:53 +01:00
parent 96ddd32c4b
commit 5fd561dea2

View File

@ -713,10 +713,11 @@ fn issue_39364() {
let t = thread::spawn(move || {
thread::sleep(Duration::from_millis(300));
let _ = tx.clone();
crate::mem::forget(tx);
// Don't drop; hand back to caller.
tx
});
let _ = rx.recv_timeout(Duration::from_millis(500));
t.join().unwrap();
let _tx = t.join().unwrap(); // delay dropping until end of test
let _ = rx.recv_timeout(Duration::from_millis(500));
}