Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1210,30 +1210,6 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
}

for (assoc_item_def_id, term) in assoc_items {
// Skip printing `<{coroutine@} as Coroutine<_>>::Return` from async blocks,
// unless we can find out what coroutine return type it comes from.
let term = if let Some(ty) = term.skip_binder().as_type()
&& let ty::Alias(ty::Projection, proj) = ty.kind()
&& let Some(assoc) = tcx.opt_associated_item(proj.def_id)
&& assoc
.trait_container(tcx)
.is_some_and(|def_id| tcx.is_lang_item(def_id, LangItem::Coroutine))
&& assoc.opt_name() == Some(rustc_span::sym::Return)
{
if let ty::Coroutine(_, args) = args.type_at(0).kind() {
let return_ty = args.as_coroutine().return_ty();
if !return_ty.is_ty_var() {
return_ty.into()
} else {
continue;
}
} else {
continue;
}
} else {
term.skip_binder()
};

if first {
p!("<");
first = false;
Expand All @@ -1243,7 +1219,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {

p!(write("{} = ", tcx.associated_item(assoc_item_def_id).name()));

match term.kind() {
match term.skip_binder().kind() {
TermKind::Ty(ty) => p!(print(ty)),
TermKind::Const(c) => p!(print(c)),
};
Expand Down
Loading