properly pretty-print inherent projections

This commit is contained in:
León Orell Valerian Liehr
2023-05-12 01:36:37 +02:00
parent c2ccc855e7
commit 778abc7a00
4 changed files with 28 additions and 4 deletions

View File

@@ -220,7 +220,7 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
match *ty.kind() {
// Print all nominal types as paths (unlike `pretty_print_type`).
ty::FnDef(def_id, substs)
| ty::Alias(_, ty::AliasTy { def_id, substs, .. })
| ty::Alias(ty::Projection | ty::Opaque, ty::AliasTy { def_id, substs, .. })
| ty::Closure(def_id, substs)
| ty::Generator(def_id, substs, _) => self.print_def_path(def_id, substs),
@@ -241,6 +241,8 @@ impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
Ok(self)
}
ty::Alias(ty::Inherent, _) => panic!("unexpected inherent projection"),
_ => self.pretty_print_type(ty),
}
}