diff --git a/compiler/rustc_const_eval/src/util/type_name.rs b/compiler/rustc_const_eval/src/util/type_name.rs index e8f2728a7728f..b5859337d91d6 100644 --- a/compiler/rustc_const_eval/src/util/type_name.rs +++ b/compiler/rustc_const_eval/src/util/type_name.rs @@ -42,11 +42,16 @@ impl<'tcx> Printer<'tcx> for AbsolutePathPrinter<'tcx> { | ty::UnsafeBinder(_) => self.pretty_print_type(ty), // Placeholders (all printed as `_` to uniformize them). - ty::Param(_) | ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => { + ty::Bound(..) | ty::Placeholder(_) | ty::Infer(_) | ty::Error(_) => { write!(self, "_")?; Ok(()) } + ty::Param(param_ty) => { + write!(self, "{}", param_ty.name)?; + Ok(()) + } + // Types with identity (print the module path). ty::Adt(ty::AdtDef(Interned(&ty::AdtDefData { did: def_id, .. }, _)), args) | ty::FnDef(def_id, args) diff --git a/tests/ui/issues/issue-61894.rs b/tests/ui/issues/issue-61894.rs index 40ad6a8d76a01..75ecb8556fe98 100644 --- a/tests/ui/issues/issue-61894.rs +++ b/tests/ui/issues/issue-61894.rs @@ -17,5 +17,5 @@ impl Bar { } fn main() { - assert_eq!(Bar(()).foo(), "issue_61894::Bar<_>::foo::f"); + assert_eq!(Bar(()).foo(), "issue_61894::Bar::foo::f"); }