File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -391,13 +391,17 @@ fn run_compiler(
391
391
392
392
let linker = compiler. enter( |queries| {
393
393
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.
394
397
queries. parse( ) ?;
395
398
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( ) {
398
402
queries. global_ctxt( ) ?. enter( |tcx| {
399
403
tcx. ensure( ) . early_lint_checks( ( ) ) ;
400
- pretty:: print( sess, * ppm , pretty:: PrintExtra :: NeedsAstMap { tcx } ) ;
404
+ pretty:: print( sess, pp_mode , pretty:: PrintExtra :: NeedsAstMap { tcx } ) ;
401
405
Ok ( ( ) )
402
406
} ) ?;
403
407
@@ -408,7 +412,7 @@ fn run_compiler(
408
412
let krate = queries. parse( ) ?;
409
413
pretty:: print(
410
414
sess,
411
- * ppm ,
415
+ pp_mode ,
412
416
pretty:: PrintExtra :: AfterParsing { krate: & * krate. borrow( ) } ,
413
417
) ;
414
418
}
Original file line number Diff line number Diff line change @@ -2893,6 +2893,7 @@ pub enum PpHirMode {
2893
2893
}
2894
2894
2895
2895
#[ derive( Copy , Clone , PartialEq , Debug ) ]
2896
+ /// Pretty print mode
2896
2897
pub enum PpMode {
2897
2898
/// Options that print the source code, i.e.
2898
2899
/// `-Zunpretty=normal` and `-Zunpretty=expanded`
You can’t perform that action at this time.
0 commit comments