]> git.lizzy.rs Git - rust.git/blob - tests/ui/async-await/issue-64130-4-async-move.rs
Rollup merge of #107048 - DebugSteven:newer-x-check-cargo, r=albertlarsan68
[rust.git] / tests / ui / async-await / issue-64130-4-async-move.rs
1 // edition:2018
2 // revisions: no_drop_tracking drop_tracking
3 // [drop_tracking] check-pass
4 // [drop_tracking] compile-flags: -Zdrop-tracking=yes
5 // [no_drop_tracking] compile-flags: -Zdrop-tracking=no
6 use std::any::Any;
7 use std::future::Future;
8
9 struct Client(Box<dyn Any + Send>);
10
11 impl Client {
12     fn status(&self) -> u16 {
13         200
14     }
15 }
16
17 async fn get() {}
18
19 pub fn foo() -> impl Future + Send {
20     //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
21     let client = Client(Box::new(true));
22     async move {
23         match client.status() {
24             200 => {
25                 let _x = get().await;
26             }
27             _ => (),
28         }
29     }
30 }
31
32 fn main() {}