2019-10-06 23:14:34 +01:00
|
|
|
// edition:2018
|
|
|
|
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 {
|
2022-02-11 07:18:06 +00:00
|
|
|
//~^ ERROR future cannot be sent between threads safely
|
2019-10-06 23:14:34 +01:00
|
|
|
let client = Client(Box::new(true));
|
|
|
|
async move {
|
|
|
|
match client.status() {
|
|
|
|
200 => {
|
|
|
|
let _x = get().await;
|
|
|
|
},
|
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|