1
Fork 0

Don't steal the parse query when using --pretty

This is the only place aside from the global_ctxt query where it is
stolen.
This commit is contained in:
bjorn3 2023-11-04 18:02:31 +00:00
parent 992943dbae
commit 1a1b10fa63
2 changed files with 7 additions and 3 deletions

View file

@ -421,8 +421,12 @@ fn run_compiler(
// effects of writing the dep-info and reporting errors. // effects of writing the dep-info and reporting errors.
queries.global_ctxt()?.enter(|tcx| tcx.output_filenames(())); queries.global_ctxt()?.enter(|tcx| tcx.output_filenames(()));
} else { } else {
let krate = queries.parse()?.steal(); let krate = queries.parse()?;
pretty::print(sess, *ppm, pretty::PrintExtra::AfterParsing { krate }); pretty::print(
sess,
*ppm,
pretty::PrintExtra::AfterParsing { krate: &*krate.borrow() },
);
} }
trace!("finished pretty-printing"); trace!("finished pretty-printing");
return early_exit(); return early_exit();

View file

@ -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 // Extra data for pretty-printing, the form of which depends on what kind of
// pretty-printing we are doing. // pretty-printing we are doing.
pub enum PrintExtra<'tcx> { pub enum PrintExtra<'tcx> {
AfterParsing { krate: ast::Crate }, AfterParsing { krate: &'tcx ast::Crate },
NeedsAstMap { tcx: TyCtxt<'tcx> }, NeedsAstMap { tcx: TyCtxt<'tcx> },
} }