1
Fork 0

Rollup merge of #95225 - compiler-errors:impl-future-generator-ty, r=oli-obk

remove `[async output]` from `impl Future` pretty-printing

self-explanatory, guess it's not as helpful as I thought when I added it 4 months ago
re https://github.com/rust-lang/rust/issues/95089#issuecomment-1075482851
This commit is contained in:
Matthias Krüger 2022-03-23 22:13:25 +01:00 committed by GitHub
commit 1f346bd6a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 39 additions and 34 deletions

View file

@ -41,6 +41,7 @@
#![feature(new_uninit)]
#![feature(nll)]
#![feature(once_cell)]
#![feature(let_chains)]
#![feature(let_else)]
#![feature(min_specialization)]
#![feature(trusted_len)]

View file

@ -896,44 +896,48 @@ pub trait PrettyPrinter<'tcx>:
);
if !generics.is_empty() || !assoc_items.is_empty() {
p!("<");
let mut first = true;
for ty in generics {
if !first {
if first {
p!("<");
first = false;
} else {
p!(", ");
}
p!(print(trait_ref.rebind(*ty)));
first = false;
}
for (assoc_item_def_id, term) in assoc_items {
if !first {
// Skip printing `<[generator@] as Generator<_>>::Return` from async blocks
if let Some(ty) = term.skip_binder().ty() &&
let ty::Projection(ty::ProjectionTy { item_def_id, .. }) = ty.kind() &&
Some(*item_def_id) == self.tcx().lang_items().generator_return() {
continue;
}
if first {
p!("<");
first = false;
} else {
p!(", ");
}
p!(write("{} = ", self.tcx().associated_item(assoc_item_def_id).name));
match term.skip_binder() {
Term::Ty(ty) => {
// Skip printing `<[generator@] as Generator<_>>::Return` from async blocks
if matches!(
ty.kind(), ty::Projection(ty::ProjectionTy { item_def_id, .. })
if Some(*item_def_id) == self.tcx().lang_items().generator_return()
) {
p!("[async output]")
} else {
p!(print(ty))
}
p!(print(ty))
}
Term::Const(c) => {
p!(print(c));
}
};
first = false;
}
p!(">");
if !first {
p!(">");
}
}
first = false;