diff options
| author | Michael Goulet <michael@errs.io> | 2025-06-25 17:07:18 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-07-04 18:26:09 +0000 |
| commit | d79b669b09909e1280af940f7b2739d018e14327 (patch) | |
| tree | c00dee8c74d3866371d860f5c918b315c2d7cfe2 /compiler/rustc_middle/src | |
| parent | 74570e526e6816b04c479a34dc1f2116e121e798 (diff) | |
| download | rust-d79b669b09909e1280af940f7b2739d018e14327.tar.gz rust-d79b669b09909e1280af940f7b2739d018e14327.zip | |
Fix pretty printing of placeholder types
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 18 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/structural_impls.rs | 2 |
2 files changed, 12 insertions, 8 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 9cb049cd622..d991b3126e7 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -822,13 +822,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write { ty::Alias(ty::Projection | ty::Inherent | ty::Free, ref data) => { p!(print(data)) } - ty::Placeholder(placeholder) => match placeholder.bound.kind { - ty::BoundTyKind::Anon => p!(write("{placeholder:?}")), - ty::BoundTyKind::Param(def_id) => match self.should_print_verbose() { - true => p!(write("{:?}", ty.kind())), - false => p!(write("{}", self.tcx().item_name(def_id))), - }, - }, + ty::Placeholder(placeholder) => p!(print(placeholder)), ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => { // We use verbose printing in 'NO_QUERIES' mode, to // avoid needing to call `predicates_of`. This should @@ -3373,6 +3367,16 @@ define_print_and_forward_display! { p!(write("{}", self.name)) } + ty::PlaceholderType { + match self.bound.kind { + ty::BoundTyKind::Anon => p!(write("{self:?}")), + ty::BoundTyKind::Param(def_id) => match cx.should_print_verbose() { + true => p!(write("{self:?}")), + false => p!(write("{}", cx.tcx().item_name(def_id))), + }, + } + } + ty::ParamConst { p!(write("{}", self.name)) } diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index 049f85ed651..af9c98bd87d 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -272,7 +272,6 @@ TrivialTypeTraversalImpls! { crate::ty::BoundVar, crate::ty::InferConst, crate::ty::Placeholder<crate::ty::BoundRegion>, - crate::ty::Placeholder<crate::ty::BoundTy>, crate::ty::Placeholder<ty::BoundVar>, crate::ty::UserTypeAnnotationIndex, crate::ty::ValTree<'tcx>, @@ -303,6 +302,7 @@ TrivialTypeTraversalAndLiftImpls! { // tidy-alphabetical-start crate::ty::ParamConst, crate::ty::ParamTy, + crate::ty::Placeholder<crate::ty::BoundTy>, crate::ty::instance::ReifyReason, rustc_hir::def_id::DefId, // tidy-alphabetical-end |
