]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/partial-drop-partial-reinit.rs
Auto merge of #98246 - joshtriplett:times, r=m-ou-se
[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     //~| NOTE cannot be sent
9     //~| NOTE bound introduced by
10     //~| NOTE appears within the type
11     //~| NOTE captures the following types
12 }
13
14 fn gimme_send<T: Send>(t: T) {
15 //~^ NOTE required by this bound
16 //~| NOTE required by a bound
17     drop(t);
18 }
19
20 struct NotSend {}
21
22 impl Drop for NotSend {
23     fn drop(&mut self) {}
24 }
25
26 impl !Send for NotSend {}
27
28 async fn foo() {
29 //~^ NOTE used within this `async fn` body
30 //~| NOTE within this `impl Future
31     let mut x = (NotSend {},);
32     drop(x.0);
33     x.0 = NotSend {};
34     bar().await;
35 }
36
37 async fn bar() {}