@@ -875,6 +875,8 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
875
875
} ) ;
876
876
// Freeze definitions as we don't add new ones at this point.
877
877
// We need to wait until now since we synthesize a by-move body
878
+ // for all coroutine-closures.
879
+ //
878
880
// This improves performance by allowing lock-free access to them.
879
881
tcx. untracked ( ) . definitions . freeze ( ) ;
880
882
@@ -887,7 +889,7 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
887
889
} ) ;
888
890
} ) ;
889
891
sess. time ( "MIR_effect_checking" , || {
890
- for def_id in tcx. hir ( ) . body_owners ( ) {
892
+ tcx. hir ( ) . par_body_owners ( |def_id| {
891
893
tcx. ensure ( ) . has_ffi_unwind_calls ( def_id) ;
892
894
893
895
// If we need to codegen, ensure that we emit all errors from
@@ -898,15 +900,17 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
898
900
{
899
901
tcx. ensure ( ) . mir_drops_elaborated_and_const_checked ( def_id) ;
900
902
}
901
- }
903
+ } ) ;
902
904
} ) ;
903
- tcx. hir ( ) . par_body_owners ( |def_id| {
904
- if tcx. is_coroutine ( def_id. to_def_id ( ) ) {
905
- tcx. ensure ( ) . mir_coroutine_witnesses ( def_id) ;
906
- tcx. ensure ( ) . check_coroutine_obligations (
907
- tcx. typeck_root_def_id ( def_id. to_def_id ( ) ) . expect_local ( ) ,
908
- ) ;
909
- }
905
+ sess. time ( "coroutine_obligations" , || {
906
+ tcx. hir ( ) . par_body_owners ( |def_id| {
907
+ if tcx. is_coroutine ( def_id. to_def_id ( ) ) {
908
+ tcx. ensure ( ) . mir_coroutine_witnesses ( def_id) ;
909
+ tcx. ensure ( ) . check_coroutine_obligations (
910
+ tcx. typeck_root_def_id ( def_id. to_def_id ( ) ) . expect_local ( ) ,
911
+ ) ;
912
+ }
913
+ } ) ;
910
914
} ) ;
911
915
912
916
sess. time ( "layout_testing" , || layout_test:: test_layout ( tcx) ) ;
0 commit comments