diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-03-23 08:35:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-23 08:35:36 +0100 |
| commit | 477ce585d420735ef536c3dd1417911fbe7e9a70 (patch) | |
| tree | 05fdc6e5771d72841f82b8ce3ba68e94e1ebd309 | |
| parent | e44564819c949b98d6dabfb59fe41f4124bce3ab (diff) | |
| parent | 3f7aeb30ae966bf7a73735169b4243727f5c456b (diff) | |
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```
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index e9f8f2e5865..de4c703107e 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -704,7 +704,11 @@ pub trait PrettyPrinter<'tcx>: ty::BoundTyKind::Anon(bv) => { self.pretty_print_bound_var(debruijn, ty::BoundVar::from_u32(bv))? } - ty::BoundTyKind::Param(_, s) => p!(write("{}", s)), + ty::BoundTyKind::Param(_, s) => match self.should_print_verbose() { + true if debruijn == ty::INNERMOST => p!(write("^{}", s)), + true => p!(write("^{}_{}", debruijn.index(), s)), + false => p!(write("{}", s)), + }, }, ty::Adt(def, substs) => { p!(print_def_path(def.did(), substs)); |
