From eaf4c917af8020a8c91c2b409e31ff03532d7cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Wed, 23 Feb 2022 00:00:00 +0000 Subject: [PATCH] Print `ParamTy` and `ParamConst` instead of displaying them Display for `ParamTy` and `ParamConst` is implemented in terms of print. Using print avoids creating a new `FmtPrinter` just to display the parameter name. --- compiler/rustc_middle/src/ty/print/pretty.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 359e4f5e581..60ca75e11a2 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -612,7 +612,7 @@ fn pretty_print_type(mut self, ty: Ty<'tcx>) -> Result } } ty::Error(_) => p!("[type error]"), - ty::Param(ref param_ty) => p!(write("{}", param_ty)), + ty::Param(ref param_ty) => p!(print(param_ty)), ty::Bound(debruijn, bound_ty) => match bound_ty.kind { ty::BoundTyKind::Anon => self.pretty_print_bound_var(debruijn, bound_ty.var)?, ty::BoundTyKind::Param(p) => p!(write("{}", p)), @@ -754,7 +754,7 @@ fn pretty_print_type(mut self, ty: Ty<'tcx>) -> Result } else if let Some(n) = sz.val().try_to_bits(self.tcx().data_layout.pointer_size) { p!(write("{}", n)); } else if let ty::ConstKind::Param(param) = sz.val() { - p!(write("{}", param)); + p!(print(param)); } else { p!("_"); }