diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-06-24 10:02:54 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-23 13:47:30 +0000 |
| commit | 211d2ed07bb5dff7683fb021341db751cec2ca1e (patch) | |
| tree | c17d777a1beffa6edead6677afce1c5789bc8fa8 /tests/ui/generator/not-send-sync.rs | |
| parent | 286502c9ed77e49aea5bb89cf18c5eda3a8fce92 (diff) | |
| download | rust-211d2ed07bb5dff7683fb021341db751cec2ca1e.tar.gz rust-211d2ed07bb5dff7683fb021341db751cec2ca1e.zip | |
Bless tests.
Diffstat (limited to 'tests/ui/generator/not-send-sync.rs')
| -rw-r--r-- | tests/ui/generator/not-send-sync.rs | 16 |
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); }); } |
