summaryrefslogtreecommitdiffstats
path: root/tests/ui/generator/not-send-sync.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
commit2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch)
treed325add32978dbdc1db975a438b3a77d571b1ab8 /tests/ui/generator/not-send-sync.rs
parentReleasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff)
downloadrustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz
rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/generator/not-send-sync.rs')
-rw-r--r--tests/ui/generator/not-send-sync.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/ui/generator/not-send-sync.rs b/tests/ui/generator/not-send-sync.rs
index 8ca5565fb..8794db452 100644
--- a/tests/ui/generator/not-send-sync.rs
+++ b/tests/ui/generator/not-send-sync.rs
@@ -1,6 +1,14 @@
+// revisions: no_drop_tracking drop_tracking drop_tracking_mir
+// [drop_tracking] compile-flags: -Zdrop-tracking
+// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
#![feature(generators)]
+#![feature(negative_impls)]
-use std::cell::Cell;
+struct NotSend;
+struct NotSync;
+
+impl !Send for NotSend {}
+impl !Sync for NotSync {}
fn main() {
fn assert_sync<T: Sync>(_: T) {}
@@ -8,14 +16,15 @@ fn main() {
assert_sync(|| {
//~^ ERROR: generator cannot be shared between threads safely
- let a = Cell::new(2);
+ let a = NotSync;
yield;
+ drop(a);
});
- let a = Cell::new(2);
assert_send(|| {
- //~^ ERROR: E0277
- drop(&a);
+ //~^ ERROR: generator cannot be sent between threads safely
+ let a = NotSend;
yield;
+ drop(a);
});
}