]> git.lizzy.rs Git - rust.git/blob - src/test/ui/async-await/issues/issue-78938-async-block.rs
Rollup merge of #103766 - lukas-code:error-in-core, r=Dylan-DPC
[rust.git] / src / test / ui / async-await / issues / issue-78938-async-block.rs
1 // edition:2018
2
3 use std::{sync::Arc, future::Future, pin::Pin, task::{Context, Poll}};
4
5 async fn f() {
6     let room_ref = Arc::new(Vec::new());
7
8     let gameloop_handle = spawn(async { //~ ERROR E0373
9         game_loop(Arc::clone(&room_ref))
10     });
11     gameloop_handle.await;
12 }
13
14 fn game_loop(v: Arc<Vec<usize>>) {}
15
16 fn spawn<F>(future: F) -> JoinHandle
17 where
18     F: Future + Send + 'static,
19     F::Output: Send + 'static,
20 {
21     loop {}
22 }
23
24 struct JoinHandle;
25
26 impl Future for JoinHandle {
27     type Output = ();
28     fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
29         loop {}
30     }
31 }
32
33 fn main() {}