]> git.proxmox.com Git - rustc.git/blob - src/test/ui/generator/partial-drop.rs
New upstream version 1.60.0+dfsg1
[rustc.git] / src / test / ui / generator / partial-drop.rs
1 // FIXME(eholk): temporarily disabled while drop range tracking is disabled
2 // (see generator_interior.rs:27)
3 // ignore-test
4
5 #![feature(negative_impls, generators)]
6
7 struct Foo;
8 impl !Send for Foo {}
9
10 struct Bar {
11 foo: Foo,
12 x: i32,
13 }
14
15 fn main() {
16 assert_send(|| {
17 //~^ ERROR generator cannot be sent between threads safely
18 // FIXME: it would be nice to make this work.
19 let guard = Bar { foo: Foo, x: 42 };
20 drop(guard.foo);
21 yield;
22 });
23
24 assert_send(|| {
25 //~^ ERROR generator cannot be sent between threads safely
26 // FIXME: it would be nice to make this work.
27 let guard = Bar { foo: Foo, x: 42 };
28 drop(guard);
29 guard.foo = Foo;
30 guard.x = 23;
31 yield;
32 });
33
34 assert_send(|| {
35 //~^ ERROR generator cannot be sent between threads safely
36 // FIXME: it would be nice to make this work.
37 let guard = Bar { foo: Foo, x: 42 };
38 let Bar { foo, x } = guard;
39 drop(foo);
40 yield;
41 });
42 }
43
44 fn assert_send<T: Send>(_: T) {}