diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:41 +0000 |
commit | 4f9fe856a25ab29345b90e7725509e9ee38a37be (patch) | |
tree | e4ffd8a9374cae7b21f7cbfb352927e0e074aff6 /compiler/rustc_driver_impl/src/pretty.rs | |
parent | Adding upstream version 1.68.2+dfsg1. (diff) | |
download | rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.tar.xz rustc-4f9fe856a25ab29345b90e7725509e9ee38a37be.zip |
Adding upstream version 1.69.0+dfsg1.upstream/1.69.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | compiler/rustc_driver_impl/src/pretty.rs (renamed from compiler/rustc_driver/src/pretty.rs) | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/compiler/rustc_driver/src/pretty.rs b/compiler/rustc_driver_impl/src/pretty.rs index ae3ac8625..446c6832c 100644 --- a/compiler/rustc_driver/src/pretty.rs +++ b/compiler/rustc_driver_impl/src/pretty.rs @@ -403,7 +403,7 @@ pub fn print_after_parsing(sess: &Session, krate: &ast::Crate, ppm: PpMode) { write_or_print(&out, sess); } -pub fn print_after_hir_lowering<'tcx>(tcx: TyCtxt<'tcx>, krate: &ast::Crate, ppm: PpMode) { +pub fn print_after_hir_lowering<'tcx>(tcx: TyCtxt<'tcx>, ppm: PpMode) { if ppm.needs_analysis() { abort_on_err(print_with_analysis(tcx, ppm), tcx.sess); return; @@ -420,7 +420,7 @@ pub fn print_after_hir_lowering<'tcx>(tcx: TyCtxt<'tcx>, krate: &ast::Crate, ppm let parse = &sess.parse_sess; pprust::print_crate( sess.source_map(), - krate, + &tcx.resolver_for_lowering(()).borrow().1, src_name, src, annotation.pp_ann(), @@ -433,7 +433,7 @@ pub fn print_after_hir_lowering<'tcx>(tcx: TyCtxt<'tcx>, krate: &ast::Crate, ppm AstTree(PpAstTreeMode::Expanded) => { debug!("pretty-printing expanded AST"); - format!("{krate:#?}") + format!("{:#?}", tcx.resolver_for_lowering(()).borrow().1) } Hir(s) => call_with_pp_support_hir(&s, tcx, move |annotation, hir_map| { @@ -498,6 +498,21 @@ fn print_with_analysis(tcx: TyCtxt<'_>, ppm: PpMode) -> Result<(), ErrorGuarante out } + ThirFlat => { + let mut out = String::new(); + abort_on_err(rustc_hir_analysis::check_crate(tcx), tcx.sess); + debug!("pretty printing THIR flat"); + for did in tcx.hir().body_owners() { + let _ = writeln!( + out, + "{:?}:\n{}\n", + did, + tcx.thir_flat(ty::WithOptConstParam::unknown(did)) + ); + } + out + } + _ => unreachable!(), }; |