mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
edafbaffb2
- Either explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Fix disjoint-capture-in-same-closure test
35 lines
740 B
Rust
35 lines
740 B
Rust
// 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 => {
|
|
get().await;
|
|
}
|
|
_ => (),
|
|
}
|
|
}
|
|
}
|
|
|
|
fn main() {}
|