Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/body/pretty.rs')
-rw-r--r--crates/hir-def/src/body/pretty.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/crates/hir-def/src/body/pretty.rs b/crates/hir-def/src/body/pretty.rs
index f8b159797e..610b7d8008 100644
--- a/crates/hir-def/src/body/pretty.rs
+++ b/crates/hir-def/src/body/pretty.rs
@@ -375,9 +375,20 @@ impl<'a> Printer<'a> {
}
}
w!(self, "|");
- if let Some(ret_ty) = ret_type {
- w!(self, " -> ");
- self.print_type_ref(ret_ty);
+ match (ret_type, closure_kind) {
+ (Some(ret_ty), ClosureKind::Async) => {
+ w!(self, " -> impl Future<Output = ");
+ self.print_type_ref(ret_ty);
+ w!(self, ">");
+ }
+ (Some(ret_ty), _) => {
+ w!(self, " -> ");
+ self.print_type_ref(ret_ty);
+ }
+ (None, ClosureKind::Async) => {
+ w!(self, " -> impl Future<Output = {{unknown}}>"); // FIXME(zachs18): {unknown} or ()?
+ }
+ (None, _) => {}
}
self.whitespace();
self.print_expr(*body);