Prefer queries over Compiler methods
This commit is contained in:
parent
bcc8b05d5c
commit
3ddb54f155
2 changed files with 4 additions and 5 deletions
|
@ -296,9 +296,8 @@ fn run_compiler(
|
|||
|
||||
if let Some(ppm) = &sess.opts.pretty {
|
||||
if ppm.needs_ast_map() {
|
||||
let expanded_crate = queries.expansion()?.borrow().0.clone();
|
||||
queries.global_ctxt()?.enter(|tcx| {
|
||||
pretty::print_after_hir_lowering(tcx, &*expanded_crate, *ppm);
|
||||
pretty::print_after_hir_lowering(tcx, *ppm);
|
||||
Ok(())
|
||||
})?;
|
||||
} else {
|
||||
|
|
|
@ -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| {
|
||||
|
|
Loading…
Add table
Reference in a new issue