about summary refs log tree commit diff
path: root/tests/ui/async-await/async-closures/overlapping-projs.rs
blob: f778534cfe26e9b62b5b6c7de8b07d4128dc896c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
//@ aux-build:block-on.rs
//@ edition:2021
//@ run-pass
//@ check-run-results

#![feature(async_closure)]

extern crate block_on;

async fn call_once(f: impl AsyncFnOnce()) {
    f().await;
}

async fn async_main() {
    let x = &mut 0;
    let y = &mut 0;
    let c = async || {
        *x = 1;
        *y = 2;
    };
    call_once(c).await;
    println!("{x} {y}");
}

fn main() {
    block_on::block_on(async_main());
}