]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/partial-drop-partial-reinit.rs
Rollup merge of #94006 - pierwill:upvar-field, r=nikomatsakis
[rust.git] / src / test / ui / async-await / partial-drop-partial-reinit.rs
1 // edition:2021
2 #![feature(negative_impls)]
3 #![allow(unused)]
4
5 fn main() {
6     gimme_send(foo());
7     //~^ ERROR cannot be sent between threads safely
8 }
9
10 fn gimme_send<T: Send>(t: T) {
11     drop(t);
12 }
13
14 struct NotSend {}
15
16 impl Drop for NotSend {
17     fn drop(&mut self) {}
18 }
19
20 impl !Send for NotSend {}
21
22 async fn foo() {
23     let mut x = (NotSend {},);
24     drop(x.0);
25     x.0 = NotSend {};
26     bar().await;
27 }
28
29 async fn bar() {}