@@ -69,7 +69,6 @@ pub fn compile_input(sess: Session,
69
69
let state = $make_state;
70
70
( control. $point. callback) ( state) ;
71
71
72
- $tsess. abort_if_errors( ) ;
73
72
if control. $point. stop == Compilation :: Stop {
74
73
return ;
75
74
}
@@ -481,13 +480,15 @@ pub fn phase_2_configure_and_expand(sess: &Session,
481
480
} ) ;
482
481
483
482
time ( time_passes, "gated macro checking" , || {
484
- let features = syntax:: feature_gate:: check_crate_macros ( sess. codemap ( ) ,
485
- & sess. parse_sess . span_diagnostic ,
486
- & krate) ;
487
-
488
- // these need to be set "early" so that expansion sees `quote` if enabled.
489
- * sess. features . borrow_mut ( ) = features;
490
- sess. abort_if_errors ( ) ;
483
+ sess. abort_if_new_errors ( || {
484
+ let features =
485
+ syntax:: feature_gate:: check_crate_macros ( sess. codemap ( ) ,
486
+ & sess. parse_sess . span_diagnostic ,
487
+ & krate) ;
488
+
489
+ // these need to be set "early" so that expansion sees `quote` if enabled.
490
+ * sess. features . borrow_mut ( ) = features;
491
+ } ) ;
491
492
} ) ;
492
493
493
494
@@ -525,7 +526,7 @@ pub fn phase_2_configure_and_expand(sess: &Session,
525
526
let Registry { syntax_exts, early_lint_passes, late_lint_passes, lint_groups,
526
527
llvm_passes, attributes, .. } = registry;
527
528
528
- {
529
+ sess . abort_if_new_errors ( || {
529
530
let mut ls = sess. lint_store . borrow_mut ( ) ;
530
531
for pass in early_lint_passes {
531
532
ls. register_early_pass ( Some ( sess) , true , pass) ;
@@ -540,17 +541,14 @@ pub fn phase_2_configure_and_expand(sess: &Session,
540
541
541
542
* sess. plugin_llvm_passes . borrow_mut ( ) = llvm_passes;
542
543
* sess. plugin_attributes . borrow_mut ( ) = attributes. clone ( ) ;
543
- }
544
+ } ) ;
544
545
545
546
// Lint plugins are registered; now we can process command line flags.
546
547
if sess. opts . describe_lints {
547
548
super :: describe_lints ( & * sess. lint_store . borrow ( ) , true ) ;
548
549
return None ;
549
550
}
550
- sess. lint_store . borrow_mut ( ) . process_command_line ( sess) ;
551
-
552
- // Abort if there are errors from lint processing or a plugin registrar.
553
- sess. abort_if_errors ( ) ;
551
+ sess. abort_if_new_errors ( || sess. lint_store . borrow_mut ( ) . process_command_line ( sess) ) ;
554
552
555
553
krate = time ( time_passes, "expansion" , || {
556
554
// Windows dlls do not have rpaths, so they don't know how to find their
@@ -594,13 +592,14 @@ pub fn phase_2_configure_and_expand(sess: &Session,
594
592
// much as possible (e.g. help the programmer avoid platform
595
593
// specific differences)
596
594
time ( time_passes, "complete gated feature checking 1" , || {
597
- let features = syntax:: feature_gate:: check_crate ( sess. codemap ( ) ,
598
- & sess. parse_sess . span_diagnostic ,
599
- & krate,
600
- & attributes,
601
- sess. opts . unstable_features ) ;
602
- * sess. features . borrow_mut ( ) = features;
603
- sess. abort_if_errors ( ) ;
595
+ sess. abort_if_new_errors ( || {
596
+ let features = syntax:: feature_gate:: check_crate ( sess. codemap ( ) ,
597
+ & sess. parse_sess . span_diagnostic ,
598
+ & krate,
599
+ & attributes,
600
+ sess. opts . unstable_features ) ;
601
+ * sess. features . borrow_mut ( ) = features;
602
+ } ) ;
604
603
} ) ;
605
604
606
605
// JBC: make CFG processing part of expansion to avoid this problem:
@@ -639,13 +638,14 @@ pub fn phase_2_configure_and_expand(sess: &Session,
639
638
// later, to make sure we've got everything (e.g. configuration
640
639
// can insert new attributes via `cfg_attr`)
641
640
time ( time_passes, "complete gated feature checking 2" , || {
642
- let features = syntax:: feature_gate:: check_crate ( sess. codemap ( ) ,
643
- & sess. parse_sess . span_diagnostic ,
644
- & krate,
645
- & attributes,
646
- sess. opts . unstable_features ) ;
647
- * sess. features . borrow_mut ( ) = features;
648
- sess. abort_if_errors ( ) ;
641
+ sess. abort_if_new_errors ( || {
642
+ let features = syntax:: feature_gate:: check_crate ( sess. codemap ( ) ,
643
+ & sess. parse_sess . span_diagnostic ,
644
+ & krate,
645
+ & attributes,
646
+ sess. opts . unstable_features ) ;
647
+ * sess. features . borrow_mut ( ) = features;
648
+ } ) ;
649
649
} ) ;
650
650
651
651
time ( time_passes,
@@ -711,9 +711,11 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
711
711
"external crate/lib resolution" ,
712
712
|| LocalCrateReader :: new ( sess, cstore, & hir_map) . read_crates ( krate) ) ;
713
713
714
- let lang_items = time ( time_passes,
715
- "language item collection" ,
716
- || middle:: lang_items:: collect_language_items ( & sess, & hir_map) ) ;
714
+ let lang_items = time ( time_passes, "language item collection" , || {
715
+ sess. abort_if_new_errors ( || {
716
+ middle:: lang_items:: collect_language_items ( & sess, & hir_map)
717
+ } )
718
+ } ) ;
717
719
718
720
let resolve:: CrateMap {
719
721
def_map,
0 commit comments