rust/tests/ui/async-await/issue-64130-4-async-move.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
740 B
Rust
Raw Normal View History

// 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
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
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() {}
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
let client = Client(Box::new(true));
async move {
match client.status() {
200 => {
get().await;
2022-09-13 16:30:54 -05:00
}
_ => (),
}
}
}
fn main() {}