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:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/threads-sendsync/send-resource.rs
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.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();
+}