]> git.proxmox.com Git - rustc.git/blob - tests/ui/async-await/return-type-notation/issue-110963-late.rs
New upstream version 1.75.0+dfsg1
[rustc.git] / tests / ui / async-await / return-type-notation / issue-110963-late.rs
1 // edition: 2021
2 // check-pass
3
4 #![feature(return_type_notation)]
5 //~^ WARN the feature `return_type_notation` is incomplete
6
7 trait HealthCheck {
8 async fn check(&mut self) -> bool;
9 }
10
11 async fn do_health_check_par<HC>(hc: HC)
12 where
13 HC: HealthCheck<check(): Send> + Send + 'static,
14 {
15 spawn(async move {
16 let mut hc = hc;
17 if !hc.check().await {
18 log_health_check_failure().await;
19 }
20 });
21 }
22
23 async fn log_health_check_failure() {}
24
25 fn main() {}
26
27 // Fake tokio spawn
28
29 use std::future::Future;
30 use std::pin::Pin;
31 use std::task::{Context, Poll};
32
33 fn spawn<F>(future: F) -> JoinHandle
34 where
35 F: Future + Send + 'static,
36 F::Output: Send + 'static,
37 {
38 loop {}
39 }
40
41 struct JoinHandle;
42
43 impl Future for JoinHandle {
44 type Output = ();
45 fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
46 loop {}
47 }
48 }