Rollup merge of #104401 - RalfJung:mpsc-leak, r=Amanieu

avoid memory leak in mpsc test

r? ```@Amanieu```
This commit is contained in:
Matthias Krüger 2022-11-16 08:36:12 +01:00 committed by GitHub
commit 4864a04c33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

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));
}