summaryrefslogtreecommitdiffstats
path: root/tests/ui/threads-sendsync/send-resource.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/threads-sendsync/send-resource.rs
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/threads-sendsync/send-resource.rs')
-rw-r--r--tests/ui/threads-sendsync/send-resource.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/ui/threads-sendsync/send-resource.rs b/tests/ui/threads-sendsync/send-resource.rs
new file mode 100644
index 000000000..023a84d6b
--- /dev/null
+++ b/tests/ui/threads-sendsync/send-resource.rs
@@ -0,0 +1,39 @@
+// run-pass
+#![allow(unused_must_use)]
+#![allow(dead_code)]
+#![allow(non_camel_case_types)]
+
+// pretty-expanded FIXME #23616
+// ignore-emscripten no threads support
+
+use std::thread;
+use std::sync::mpsc::channel;
+
+struct test {
+ f: isize,
+}
+
+impl Drop for test {
+ fn drop(&mut self) {}
+}
+
+fn test(f: isize) -> test {
+ test {
+ f: f
+ }
+}
+
+pub fn main() {
+ let (tx, rx) = channel();
+
+ let t = thread::spawn(move|| {
+ let (tx2, rx2) = channel();
+ tx.send(tx2).unwrap();
+
+ let _r = rx2.recv().unwrap();
+ });
+
+ rx.recv().unwrap().send(test(42)).unwrap();
+
+ t.join();
+}