about summary refs log tree commit diff
path: root/tests/ui/generator/not-send-sync.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/generator/not-send-sync.rs')
-rw-r--r--tests/ui/generator/not-send-sync.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/ui/generator/not-send-sync.rs b/tests/ui/generator/not-send-sync.rs
index 8ca5565fb2a..16c8cd47629 100644
--- a/tests/ui/generator/not-send-sync.rs
+++ b/tests/ui/generator/not-send-sync.rs
@@ -1,6 +1,11 @@
 #![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 +13,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);
     });
 }