rust/tests/ui/async-await/async-closures/box-deref-in-debuginfo.rs

36 lines
586 B
Rust

//@ aux-build:block-on.rs
//@ edition:2021
//@ run-pass
#![feature(async_closure)]
extern crate block_on;
pub trait Trait {
fn callback(&mut self);
}
impl Trait for (i32,) {
fn callback(&mut self) {
println!("hi {}", self.0);
self.0 += 1;
}
}
async fn call_once(f: impl async FnOnce()) {
f().await;
}
async fn run(mut loader: Box<dyn Trait>) {
let f = async move || {
loader.callback();
loader.callback();
};
call_once(f).await;
}
fn main() {
block_on::block_on(async {
run(Box::new((42,))).await;
});
}