Skip to content

Commit 3ddb54f

Browse files
committed
Prefer queries over Compiler methods
1 parent bcc8b05 commit 3ddb54f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

compiler/rustc_driver/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,8 @@ fn run_compiler(
296296

297297
if let Some(ppm) = &sess.opts.pretty {
298298
if ppm.needs_ast_map() {
299-
let expanded_crate = queries.expansion()?.borrow().0.clone();
300299
queries.global_ctxt()?.enter(|tcx| {
301-
pretty::print_after_hir_lowering(tcx, &*expanded_crate, *ppm);
300+
pretty::print_after_hir_lowering(tcx, *ppm);
302301
Ok(())
303302
})?;
304303
} else {

compiler/rustc_driver/src/pretty.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ pub fn print_after_parsing(sess: &Session, krate: &ast::Crate, ppm: PpMode) {
403403
write_or_print(&out, sess);
404404
}
405405

406-
pub fn print_after_hir_lowering<'tcx>(tcx: TyCtxt<'tcx>, krate: &ast::Crate, ppm: PpMode) {
406+
pub fn print_after_hir_lowering<'tcx>(tcx: TyCtxt<'tcx>, ppm: PpMode) {
407407
if ppm.needs_analysis() {
408408
abort_on_err(print_with_analysis(tcx, ppm), tcx.sess);
409409
return;
@@ -420,7 +420,7 @@ pub fn print_after_hir_lowering<'tcx>(tcx: TyCtxt<'tcx>, krate: &ast::Crate, ppm
420420
let parse = &sess.parse_sess;
421421
pprust::print_crate(
422422
sess.source_map(),
423-
krate,
423+
&tcx.resolver_for_lowering(()).borrow().1,
424424
src_name,
425425
src,
426426
annotation.pp_ann(),
@@ -433,7 +433,7 @@ pub fn print_after_hir_lowering<'tcx>(tcx: TyCtxt<'tcx>, krate: &ast::Crate, ppm
433433

434434
AstTree(PpAstTreeMode::Expanded) => {
435435
debug!("pretty-printing expanded AST");
436-
format!("{krate:#?}")
436+
format!("{:#?}", tcx.resolver_for_lowering(()).borrow().1)
437437
}
438438

439439
Hir(s) => call_with_pp_support_hir(&s, tcx, move |annotation, hir_map| {

0 commit comments

Comments
 (0)