summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/issue-64130-4-async-move.rs
blob: bcb297aaa02585a994f8be3869c447f0fb0291fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// edition:2018
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
// [drop_tracking] compile-flags: -Zdrop-tracking
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
// [drop_tracking_mir] check-pass
// [drop_tracking] check-pass

use std::any::Any;
use std::future::Future;

struct Client(Box<dyn Any + Send>);

impl Client {
    fn status(&self) -> u16 {
        200
    }
}

async fn get() {}

pub fn foo() -> impl Future + Send {
    //[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
    let client = Client(Box::new(true));
    async move {
        match client.status() {
            200 => {
                let _x = get().await;
            }
            _ => (),
        }
    }
}

fn main() {}