2019-10-06 17:14:34 -05:00
|
|
|
// edition:2018
|
2022-10-01 05:19:31 -05:00
|
|
|
// revisions: no_drop_tracking drop_tracking drop_tracking_mir
|
|
|
|
// [drop_tracking] compile-flags: -Zdrop-tracking
|
|
|
|
// [drop_tracking_mir] compile-flags: -Zdrop-tracking-mir
|
2023-01-25 21:51:26 -06:00
|
|
|
// [drop_tracking_mir] check-pass
|
2022-09-13 16:30:54 -05:00
|
|
|
// [drop_tracking] check-pass
|
2022-10-01 05:19:31 -05:00
|
|
|
|
2019-10-06 17:14:34 -05:00
|
|
|
use std::any::Any;
|
|
|
|
use std::future::Future;
|
|
|
|
|
|
|
|
struct Client(Box<dyn Any + Send>);
|
|
|
|
|
|
|
|
impl Client {
|
|
|
|
fn status(&self) -> u16 {
|
|
|
|
200
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-13 16:30:54 -05:00
|
|
|
async fn get() {}
|
2019-10-06 17:14:34 -05:00
|
|
|
|
|
|
|
pub fn foo() -> impl Future + Send {
|
2022-09-13 16:30:54 -05:00
|
|
|
//[no_drop_tracking]~^ ERROR future cannot be sent between threads safely
|
2019-10-06 17:14:34 -05:00
|
|
|
let client = Client(Box::new(true));
|
|
|
|
async move {
|
|
|
|
match client.status() {
|
|
|
|
200 => {
|
|
|
|
let _x = get().await;
|
2022-09-13 16:30:54 -05:00
|
|
|
}
|
2019-10-06 17:14:34 -05:00
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|