Skip to content

Commit

Permalink
Don't steal the parse query when using --pretty
Browse files Browse the repository at this point in the history
This is the only place aside from the global_ctxt query where it is
stolen.
  • Loading branch information
bjorn3 committed Nov 5, 2023
1 parent 992943d commit 1a1b10f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions compiler/rustc_driver_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,12 @@ fn run_compiler(
// effects of writing the dep-info and reporting errors.
queries.global_ctxt()?.enter(|tcx| tcx.output_filenames(()));
} else {
let krate = queries.parse()?.steal();
pretty::print(sess, *ppm, pretty::PrintExtra::AfterParsing { krate });
let krate = queries.parse()?;
pretty::print(
sess,
*ppm,
pretty::PrintExtra::AfterParsing { krate: &*krate.borrow() },
);
}
trace!("finished pretty-printing");
return early_exit();
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_driver_impl/src/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ fn write_or_print(out: &str, sess: &Session) {
// Extra data for pretty-printing, the form of which depends on what kind of
// pretty-printing we are doing.
pub enum PrintExtra<'tcx> {
AfterParsing { krate: ast::Crate },
AfterParsing { krate: &'tcx ast::Crate },
NeedsAstMap { tcx: TyCtxt<'tcx> },
}

Expand Down

0 comments on commit 1a1b10f

Please sign in to comment.