about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-02-25 16:09:56 +0000
committerbors <bors@rust-lang.org>2022-02-25 16:09:56 +0000
commit6cbc6c35e4b0c948114619a1c883a75b731d32c5 (patch)
tree9bb6da001fbd85a049602d618f49e70cfac510b5
parent9f8f0a6e9484fe25517c082a5cbe1e9edb17c8a8 (diff)
parenteaf4c917af8020a8c91c2b409e31ff03532d7cc1 (diff)
downloadrust-6cbc6c35e4b0c948114619a1c883a75b731d32c5.tar.gz
rust-6cbc6c35e4b0c948114619a1c883a75b731d32c5.zip
Auto merge of #94279 - tmiasko:write-print, r=Mark-Simulacrum
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.

r? `@Mark-Simulacrum`
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs4
1 files 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 2070dc35729..542bc3b02e0 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -612,7 +612,7 @@ pub trait PrettyPrinter<'tcx>:
                 }
             }
             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 @@ pub trait PrettyPrinter<'tcx>:
                 } 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!("_");
                 }