diff options
Diffstat (limited to 'tests/ui/async-await/return-type-notation/issue-110963-late.rs')
-rw-r--r-- | tests/ui/async-await/return-type-notation/issue-110963-late.rs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/ui/async-await/return-type-notation/issue-110963-late.rs b/tests/ui/async-await/return-type-notation/issue-110963-late.rs new file mode 100644 index 00000000000..2a35922eaa1 --- /dev/null +++ b/tests/ui/async-await/return-type-notation/issue-110963-late.rs @@ -0,0 +1,50 @@ +// edition: 2021 +// check-pass + +#![feature(return_type_notation)] +//~^ WARN the feature `return_type_notation` is incomplete +#![feature(async_fn_in_trait)] +//~^ WARN the feature `async_fn_in_trait` 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 {} + } +} |