This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -391,13 +391,17 @@ 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)
396+ // Everything else is parsed during macro expansion.
394397 queries. parse( ) ?;
395398
396- if let Some ( ppm) = & sess. opts. pretty {
397- if ppm. needs_ast_map( ) {
399+ // If pretty printing is requested: Figure out the representation, print it and exit
400+ if let Some ( pp_mode) = sess. opts. pretty {
401+ if pp_mode. needs_ast_map( ) {
398402 queries. global_ctxt( ) ?. enter( |tcx| {
399403 tcx. ensure( ) . early_lint_checks( ( ) ) ;
400- pretty:: print( sess, * ppm , pretty:: PrintExtra :: NeedsAstMap { tcx } ) ;
404+ pretty:: print( sess, pp_mode , pretty:: PrintExtra :: NeedsAstMap { tcx } ) ;
401405 Ok ( ( ) )
402406 } ) ?;
403407
@@ -408,7 +412,7 @@ fn run_compiler(
408412 let krate = queries. parse( ) ?;
409413 pretty:: print(
410414 sess,
411- * ppm ,
415+ pp_mode ,
412416 pretty:: PrintExtra :: AfterParsing { krate: & * krate. borrow( ) } ,
413417 ) ;
414418 }
Original file line number Diff line number Diff line change @@ -2893,6 +2893,7 @@ pub enum PpHirMode {
28932893}
28942894
28952895#[ derive( Copy , Clone , PartialEq , Debug ) ]
2896+ /// Pretty print mode
28962897pub enum PpMode {
28972898 /// Options that print the source code, i.e.
28982899 /// `-Zunpretty=normal` and `-Zunpretty=expanded`
You can’t perform that action at this time.
0 commit comments