Skip to content

Commit 1a1b10f

Browse files
committed
Don't steal the parse query when using --pretty
This is the only place aside from the global_ctxt query where it is stolen.
1 parent 992943d commit 1a1b10f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

compiler/rustc_driver_impl/src/lib.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,12 @@ fn run_compiler(
421421
// effects of writing the dep-info and reporting errors.
422422
queries.global_ctxt()?.enter(|tcx| tcx.output_filenames(()));
423423
} else {
424-
let krate = queries.parse()?.steal();
425-
pretty::print(sess, *ppm, pretty::PrintExtra::AfterParsing { krate });
424+
let krate = queries.parse()?;
425+
pretty::print(
426+
sess,
427+
*ppm,
428+
pretty::PrintExtra::AfterParsing { krate: &*krate.borrow() },
429+
);
426430
}
427431
trace!("finished pretty-printing");
428432
return early_exit();

compiler/rustc_driver_impl/src/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ fn write_or_print(out: &str, sess: &Session) {
217217
// Extra data for pretty-printing, the form of which depends on what kind of
218218
// pretty-printing we are doing.
219219
pub enum PrintExtra<'tcx> {
220-
AfterParsing { krate: ast::Crate },
220+
AfterParsing { krate: &'tcx ast::Crate },
221221
NeedsAstMap { tcx: TyCtxt<'tcx> },
222222
}
223223

0 commit comments

Comments
 (0)