Skip to content

Commit

Permalink
Auto merge of #94279 - tmiasko:write-print, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
bors committed Feb 25, 2022
2 parents 9f8f0a6 + eaf4c91 commit 6cbc6c3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/ty/print/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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!("_");
}
Expand Down

0 comments on commit 6cbc6c3

Please sign in to comment.