Skip to content

Commit eeeb44e

Browse files
authored
Rollup merge of #109506 - BoxyUwU:debugable_bound_var_printing, r=compiler-errors
make param bound vars visibly bound vars with -Zverbose I was trying to debug some type/const bound var stuff and it was shockingly tricky due to the fact that even with `-Zverbose` enabled the `T` in `for<T> T: Trait` prints as `T` making it seem like its `TyKind::Param` when it is infact `TyKind::Bound`. This PR "fixes" this when `-Zverbose` is set to allow rendering it as `^T` or `^1_T` depending on binder depth. r? ``@compiler-errors``
2 parents 9ee96c8 + 3f7aeb3 commit eeeb44e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,11 @@ pub trait PrettyPrinter<'tcx>:
704704
ty::BoundTyKind::Anon(bv) => {
705705
self.pretty_print_bound_var(debruijn, ty::BoundVar::from_u32(bv))?
706706
}
707-
ty::BoundTyKind::Param(_, s) => p!(write("{}", s)),
707+
ty::BoundTyKind::Param(_, s) => match self.should_print_verbose() {
708+
true if debruijn == ty::INNERMOST => p!(write("^{}", s)),
709+
true => p!(write("^{}_{}", debruijn.index(), s)),
710+
false => p!(write("{}", s)),
711+
},
708712
},
709713
ty::Adt(def, substs) => {
710714
p!(print_def_path(def.did(), substs));

0 commit comments

Comments
 (0)