@@ -686,18 +686,15 @@ pub fn create_global_ctxt<'tcx>(
686686 } )
687687}
688688
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 < ' _ > ) {
692692 if tcx. sess . opts . unstable_opts . hir_stats {
693693 rustc_passes:: hir_stats:: print_hir_stats ( tcx) ;
694694 }
695-
696695 #[ cfg( debug_assertions) ]
697696 rustc_passes:: hir_id_validator:: check_crate ( tcx) ;
698-
699697 let sess = tcx. sess ;
700-
701698 sess. time ( "misc_checking_1" , || {
702699 parallel ! (
703700 {
@@ -733,10 +730,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
733730 }
734731 ) ;
735732 } ) ;
736-
737- // passes are timed inside typeck
738- rustc_hir_analysis:: check_crate ( tcx) ?;
739-
733+ rustc_hir_analysis:: check_crate ( tcx) ;
740734 sess. time ( "MIR_borrow_checking" , || {
741735 tcx. hir ( ) . par_body_owners ( |def_id| {
742736 // Run unsafety check because it's responsible for stealing and
@@ -745,7 +739,6 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
745739 tcx. ensure ( ) . mir_borrowck ( def_id)
746740 } ) ;
747741 } ) ;
748-
749742 sess. time ( "MIR_effect_checking" , || {
750743 for def_id in tcx. hir ( ) . body_owners ( ) {
751744 tcx. ensure ( ) . has_ffi_unwind_calls ( def_id) ;
@@ -761,16 +754,22 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
761754 }
762755 }
763756 } ) ;
764-
765757 tcx. hir ( ) . par_body_owners ( |def_id| {
766758 if tcx. is_coroutine ( def_id. to_def_id ( ) ) {
767759 tcx. ensure ( ) . mir_coroutine_witnesses ( def_id) ;
768760 tcx. ensure ( ) . check_coroutine_obligations ( def_id) ;
769761 }
770762 } ) ;
771-
772763 sess. time ( "layout_testing" , || layout_test:: test_layout ( tcx) ) ;
773764 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 ;
774773
775774 // Avoid overwhelming user with errors if borrow checking failed.
776775 // I'm not sure how helpful this is, to be honest, but it avoids a
0 commit comments