We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 746331e commit 642a324Copy full SHA for 642a324
library/std/src/sync/mpsc/sync_tests.rs
@@ -1,5 +1,6 @@
1
use super::*;
2
use crate::env;
3
+use crate::rc::Rc;
4
use crate::sync::mpmc::SendTimeoutError;
5
use crate::thread;
6
use crate::time::Duration;
@@ -656,3 +657,15 @@ fn issue_15761() {
656
657
repro()
658
}
659
660
+
661
+#[test]
662
+fn drop_unreceived() {
663
+ let (tx, rx) = sync_channel::<Rc<()>>(1);
664
+ let msg = Rc::new(());
665
+ let weak = Rc::downgrade(&msg);
666
+ assert!(tx.send(msg).is_ok());
667
+ drop(rx);
668
+ // Messages should be dropped immediately when the last receiver is destroyed.
669
+ assert!(weak.upgrade().is_none());
670
+ drop(tx);
671
+}
0 commit comments