blob: 7533844fb4351de20d523314a2e7be0ad6bcf4cc (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// edition: 2021
// check-pass
#![feature(return_type_notation)]
//~^ WARN the feature `return_type_notation` is incomplete
trait HealthCheck {
async fn check(&mut self) -> bool;
}
async fn do_health_check_par<HC>(hc: HC)
where
HC: HealthCheck<check(): Send> + Send + 'static,
{
spawn(async move {
let mut hc = hc;
if !hc.check().await {
log_health_check_failure().await;
}
});
}
async fn log_health_check_failure() {}
fn main() {}
// Fake tokio spawn
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
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 {}
}
}
|