diff options
| author | Smitty <me@smitop.com> | 2021-07-24 17:18:15 -0400 |
|---|---|---|
| committer | Smitty <me@smitop.com> | 2021-07-24 17:18:15 -0400 |
| commit | e8165e7f1bfdc7c82749e4bdaafec8ee1a161eb8 (patch) | |
| tree | 547655cc407876c24cb3cebda9749b6a23c585a3 /compiler/rustc_driver/src | |
| parent | bddb59cf07efcf6e606f16b87f85e3ecd2c1ca69 (diff) | |
| download | rust-e8165e7f1bfdc7c82749e4bdaafec8ee1a161eb8.tar.gz rust-e8165e7f1bfdc7c82749e4bdaafec8ee1a161eb8.zip | |
Support -Z unpretty=thir-tree again
Diffstat (limited to 'compiler/rustc_driver/src')
| -rw-r--r-- | compiler/rustc_driver/src/pretty.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/compiler/rustc_driver/src/pretty.rs b/compiler/rustc_driver/src/pretty.rs index bf131914b97..579ba43b6d8 100644 --- a/compiler/rustc_driver/src/pretty.rs +++ b/compiler/rustc_driver/src/pretty.rs @@ -14,6 +14,7 @@ use rustc_span::symbol::Ident; use rustc_span::FileName; use std::cell::Cell; +use std::fmt::Write; use std::path::Path; pub use self::PpMode::*; @@ -471,7 +472,6 @@ fn print_with_analysis( ofile: Option<&Path>, ) -> Result<(), ErrorReported> { tcx.analysis(())?; - let out = match ppm { Mir => { let mut out = Vec::new(); @@ -486,8 +486,18 @@ fn print_with_analysis( } ThirTree => { - // FIXME(rust-lang/project-thir-unsafeck#8) - todo!() + let mut out = String::new(); + abort_on_err(rustc_typeck::check_crate(tcx), tcx.sess); + debug!("pretty printing THIR tree"); + for did in tcx.body_owners() { + let _ = writeln!( + out, + "{:?}:\n{}\n", + did, + tcx.thir_tree(ty::WithOptConstParam::unknown(did)) + ); + } + out } _ => unreachable!(), |
