]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/partial-drop-partial-reinit.rs
Rollup merge of #107027 - GuillaumeGomez:rm-extra-removal, r=tmiasko
[rust.git] / tests / ui / async-await / partial-drop-partial-reinit.rs
1 // edition:2021
2 // revisions: no_drop_tracking drop_tracking
3 // [drop_tracking] compile-flags: -Zdrop-tracking=yes
4 // [no_drop_tracking] compile-flags: -Zdrop-tracking=no
5 #![feature(negative_impls)]
6 #![allow(unused)]
7
8 fn main() {
9     gimme_send(foo());
10     //~^ ERROR cannot be sent between threads safely
11     //~| NOTE cannot be sent
12     //~| NOTE bound introduced by
13     //~| NOTE appears within the type
14     //~| NOTE captures the following types
15 }
16
17 fn gimme_send<T: Send>(t: T) {
18     //~^ NOTE required by this bound
19     //~| NOTE required by a bound
20     drop(t);
21 }
22
23 struct NotSend {}
24
25 impl Drop for NotSend {
26     fn drop(&mut self) {}
27 }
28
29 impl !Send for NotSend {}
30
31 async fn foo() {
32     //~^ NOTE used within this `async fn` body
33     //~| NOTE within this `impl Future
34     let mut x = (NotSend {},);
35     drop(x.0);
36     x.0 = NotSend {};
37     bar().await;
38 }
39
40 async fn bar() {}