Skip to content

Commit 44fa9ab

Browse files
author
Orion Gonzalez
committed
clarify a few things
1 parent b218623 commit 44fa9ab

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

compiler/rustc_driver_impl/src/lib.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -391,13 +391,16 @@ fn run_compiler(
391391

392392
let linker = compiler.enter(|queries| {
393393
let early_exit = || early_exit().map(|_| None);
394+
395+
// Parse the crate root source code (doesn't parse submodules yet)
394396
queries.parse()?;
395397

396-
if let Some(ppm) = &sess.opts.pretty {
397-
if ppm.needs_ast_map() {
398+
// If pretty printing is requested: Figure out the representation, print it and exit
399+
if let Some(pp_mode) = sess.opts.pretty {
400+
if pp_mode.needs_ast_map() {
398401
queries.global_ctxt()?.enter(|tcx| {
399402
tcx.ensure().early_lint_checks(());
400-
pretty::print(sess, *ppm, pretty::PrintExtra::NeedsAstMap { tcx });
403+
pretty::print(sess, pp_mode, pretty::PrintExtra::NeedsAstMap { tcx });
401404
Ok(())
402405
})?;
403406

@@ -408,7 +411,7 @@ fn run_compiler(
408411
let krate = queries.parse()?;
409412
pretty::print(
410413
sess,
411-
*ppm,
414+
pp_mode,
412415
pretty::PrintExtra::AfterParsing { krate: &*krate.borrow() },
413416
);
414417
}

compiler/rustc_session/src/config.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2893,6 +2893,7 @@ pub enum PpHirMode {
28932893
}
28942894

28952895
#[derive(Copy, Clone, PartialEq, Debug)]
2896+
/// Pretty print mode
28962897
pub enum PpMode {
28972898
/// Options that print the source code, i.e.
28982899
/// `-Zunpretty=normal` and `-Zunpretty=expanded`

0 commit comments

Comments
 (0)