@@ -686,18 +686,15 @@ pub fn create_global_ctxt<'tcx>(
686
686
} )
687
687
}
688
688
689
- /// Runs the type-checking, region checking and other miscellaneous analysis
690
- /// passes on the crate .
691
- fn analysis ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> Result < ( ) > {
689
+ /// Runs all analyses that we guarantee to run, even if errors were reported in earlier analyses.
690
+ /// This function never fails .
691
+ fn run_required_analyses ( tcx : TyCtxt < ' _ > ) {
692
692
if tcx. sess . opts . unstable_opts . hir_stats {
693
693
rustc_passes:: hir_stats:: print_hir_stats ( tcx) ;
694
694
}
695
-
696
695
#[ cfg( debug_assertions) ]
697
696
rustc_passes:: hir_id_validator:: check_crate ( tcx) ;
698
-
699
697
let sess = tcx. sess ;
700
-
701
698
sess. time ( "misc_checking_1" , || {
702
699
parallel ! (
703
700
{
@@ -733,10 +730,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
733
730
}
734
731
) ;
735
732
} ) ;
736
-
737
- // passes are timed inside typeck
738
- rustc_hir_analysis:: check_crate ( tcx) ?;
739
-
733
+ rustc_hir_analysis:: check_crate ( tcx) ;
740
734
sess. time ( "MIR_borrow_checking" , || {
741
735
tcx. hir ( ) . par_body_owners ( |def_id| {
742
736
// Run unsafety check because it's responsible for stealing and
@@ -745,7 +739,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
745
739
tcx. ensure ( ) . mir_borrowck ( def_id)
746
740
} ) ;
747
741
} ) ;
748
-
749
742
sess. time ( "MIR_effect_checking" , || {
750
743
for def_id in tcx. hir ( ) . body_owners ( ) {
751
744
tcx. ensure ( ) . has_ffi_unwind_calls ( def_id) ;
@@ -761,16 +754,22 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
761
754
}
762
755
}
763
756
} ) ;
764
-
765
757
tcx. hir ( ) . par_body_owners ( |def_id| {
766
758
if tcx. is_coroutine ( def_id. to_def_id ( ) ) {
767
759
tcx. ensure ( ) . mir_coroutine_witnesses ( def_id) ;
768
760
tcx. ensure ( ) . check_coroutine_obligations ( def_id) ;
769
761
}
770
762
} ) ;
771
-
772
763
sess. time ( "layout_testing" , || layout_test:: test_layout ( tcx) ) ;
773
764
sess. time ( "abi_testing" , || abi_test:: test_abi ( tcx) ) ;
765
+ }
766
+
767
+ /// Runs the type-checking, region checking and other miscellaneous analysis
768
+ /// passes on the crate.
769
+ fn analysis ( tcx : TyCtxt < ' _ > , ( ) : ( ) ) -> Result < ( ) > {
770
+ run_required_analyses ( tcx) ;
771
+
772
+ let sess = tcx. sess ;
774
773
775
774
// Avoid overwhelming user with errors if borrow checking failed.
776
775
// I'm not sure how helpful this is, to be honest, but it avoids a
0 commit comments