about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src
diff options
context:
space:
mode:
authorSmitty <me@smitop.com>2021-07-24 17:18:15 -0400
committerSmitty <me@smitop.com>2021-07-24 17:18:15 -0400
commite8165e7f1bfdc7c82749e4bdaafec8ee1a161eb8 (patch)
tree547655cc407876c24cb3cebda9749b6a23c585a3 /compiler/rustc_mir_build/src
parentbddb59cf07efcf6e606f16b87f85e3ecd2c1ca69 (diff)
downloadrust-e8165e7f1bfdc7c82749e4bdaafec8ee1a161eb8.tar.gz
rust-e8165e7f1bfdc7c82749e4bdaafec8ee1a161eb8.zip
Support -Z unpretty=thir-tree again
Diffstat (limited to 'compiler/rustc_mir_build/src')
-rw-r--r--compiler/rustc_mir_build/src/lib.rs1
-rw-r--r--compiler/rustc_mir_build/src/thir/cx/mod.rs7
2 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs
index d2992f0bf18..d0dd5116b75 100644
--- a/compiler/rustc_mir_build/src/lib.rs
+++ b/compiler/rustc_mir_build/src/lib.rs
@@ -30,4 +30,5 @@ pub fn provide(providers: &mut Providers) {
     providers.thir_check_unsafety = check_unsafety::thir_check_unsafety;
     providers.thir_check_unsafety_for_const_arg = check_unsafety::thir_check_unsafety_for_const_arg;
     providers.thir_body = thir::cx::thir_body;
+    providers.thir_tree = thir::cx::thir_tree;
 }
diff --git a/compiler/rustc_mir_build/src/thir/cx/mod.rs b/compiler/rustc_mir_build/src/thir/cx/mod.rs
index 604e544286a..5059dd939d9 100644
--- a/compiler/rustc_mir_build/src/thir/cx/mod.rs
+++ b/compiler/rustc_mir_build/src/thir/cx/mod.rs
@@ -30,6 +30,13 @@ crate fn thir_body<'tcx>(
     (tcx.alloc_steal_thir(cx.thir), expr)
 }
 
+crate fn thir_tree<'tcx>(
+    tcx: TyCtxt<'tcx>,
+    owner_def: ty::WithOptConstParam<LocalDefId>,
+) -> String {
+    format!("{:#?}", thir_body(tcx, owner_def).0.steal())
+}
+
 struct Cx<'tcx> {
     tcx: TyCtxt<'tcx>,
     thir: Thir<'tcx>,