summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/issues/issue-78938-async-block.rs
blob: 36f7160198526d66a3cda0b3b63b457c2235379b (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
28
29
30
31
32
33
// edition:2018

use std::{sync::Arc, future::Future, pin::Pin, task::{Context, Poll}};

async fn f() {
    let room_ref = Arc::new(Vec::new());

    let gameloop_handle = spawn(async { //~ ERROR E0373
        game_loop(Arc::clone(&room_ref))
    });
    gameloop_handle.await;
}

fn game_loop(v: Arc<Vec<usize>>) {}

fn spawn<F>(future: F) -> JoinHandle
where
    F: Future + Send + 'static,
    F::Output: Send + 'static,
{
    loop {}
}

struct JoinHandle;

impl Future for JoinHandle {
    type Output = ();
    fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
        loop {}
    }
}

fn main() {}