about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-09-07 01:20:43 +0000
committerMichael Goulet <michael@errs.io>2023-09-07 02:08:51 +0000
commit748476d94d0fd87a0ee149e49ab3b196bbb08420 (patch)
tree116724561f045a34643a4975e170ce5fbdfc0dcb /compiler/rustc_middle
parentb0d45536acf8be99036c6a1261359e3cf89f9d63 (diff)
downloadrust-748476d94d0fd87a0ee149e49ab3b196bbb08420.tar.gz
rust-748476d94d0fd87a0ee149e49ab3b196bbb08420.zip
Print the path of an RPITIT in RTN
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index ac0c88468fa..7191ed7a0f6 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -1123,6 +1123,17 @@ pub trait PrettyPrinter<'tcx>:
             }
         }
 
+        if self.tcx().features().return_type_notation
+            && let Some(ty::ImplTraitInTraitData::Trait { fn_def_id, .. }) = self.tcx().opt_rpitit_info(def_id)
+            && let ty::Alias(_, alias_ty) = self.tcx().fn_sig(fn_def_id).skip_binder().output().skip_binder().kind()
+            && alias_ty.def_id == def_id
+        {
+            let num_args = self.tcx().generics_of(fn_def_id).count();
+            write!(self, " {{ ")?;
+            self = self.print_def_path(fn_def_id, &args[..num_args])?;
+            write!(self, "() }}")?;
+        }
+
         Ok(self)
     }