]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generator/not-send-sync.rs
Rollup merge of #43705 - panicbit:option_ref_mut_cloned, r=aturon
[rust.git] / src / test / ui / generator / not-send-sync.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![feature(generators)]
12
13 use std::cell::Cell;
14
15 fn main() {
16     fn assert_sync<T: Sync>(_: T) {}
17     fn assert_send<T: Send>(_: T) {}
18
19     assert_sync(|| {
20         //~^ ERROR: Sync` is not satisfied
21         let a = Cell::new(2);
22         yield;
23     });
24
25     let a = Cell::new(2);
26     assert_send(|| {
27         //~^ ERROR: Sync` is not satisfied
28         drop(&a);
29         yield;
30     });
31 }