From cf2dff2b1e3fa55fa5415d524200070d0d7aacfe Mon Sep 17 00:00:00 2001 From: Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> Date: Thu, 5 Jan 2023 09:13:28 +0100 Subject: Move /src/test to /tests --- .../async-await/issues/issue-78938-async-block.rs | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/ui/async-await/issues/issue-78938-async-block.rs (limited to 'tests/ui/async-await/issues/issue-78938-async-block.rs') diff --git a/tests/ui/async-await/issues/issue-78938-async-block.rs b/tests/ui/async-await/issues/issue-78938-async-block.rs new file mode 100644 index 00000000000..36f71601985 --- /dev/null +++ b/tests/ui/async-await/issues/issue-78938-async-block.rs @@ -0,0 +1,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>) {} + +fn spawn(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 { + loop {} + } +} + +fn main() {} -- cgit 1.4.1-3-g733a5