1
Fork 0

Rollup merge of #127783 - compiler-errors:rtn-pretty, r=fee1-dead

Put the dots back in RTN pretty printing

Also don't render RTN-like bounds for methods with ty/const params.
This commit is contained in:
Matthias Krüger 2024-07-18 08:08:59 +02:00 committed by GitHub
commit 97d5edf4b1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 114 additions and 8 deletions

View file

@ -1214,11 +1214,14 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
&& 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 generics = self.tcx().generics_of(fn_def_id)
// FIXME(return_type_notation): We only support lifetime params for now.
&& generics.own_params.iter().all(|param| matches!(param.kind, ty::GenericParamDefKind::Lifetime))
{
let num_args = self.tcx().generics_of(fn_def_id).count();
let num_args = generics.count();
write!(self, " {{ ")?;
self.print_def_path(fn_def_id, &args[..num_args])?;
write!(self, "() }}")?;
write!(self, "(..) }}")?;
}
Ok(())