]> git.lizzy.rs Git - rust.git/blob - tests/ui/generator/not-send-sync.rs
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / generator / not-send-sync.rs
1 #![feature(generators)]
2
3 use std::cell::Cell;
4
5 fn main() {
6     fn assert_sync<T: Sync>(_: T) {}
7     fn assert_send<T: Send>(_: T) {}
8
9     assert_sync(|| {
10         //~^ ERROR: generator cannot be shared between threads safely
11         let a = Cell::new(2);
12         yield;
13     });
14
15     let a = Cell::new(2);
16     assert_send(|| {
17         //~^ ERROR: E0277
18         drop(&a);
19         yield;
20     });
21 }