summaryrefslogtreecommitdiffstats
path: root/tests/ui/async-await/return-type-notation/issue-110963-late.rs
diff options
context:
space:
mode:
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.rs49
1 files changed, 49 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 000000000..17b5d775d
--- /dev/null
+++ b/tests/ui/async-await/return-type-notation/issue-110963-late.rs
@@ -0,0 +1,49 @@
+// edition: 2021
+// check-pass
+
+#![feature(return_type_notation)]
+//~^ WARN the feature `return_type_notation` is incomplete
+#![feature(async_fn_in_trait)]
+
+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 {}
+ }
+}