@@ -95,6 +95,7 @@ mod outlives;
9595pub mod structured_errors;
9696mod variance;
9797
98+ use rustc_data_structures:: sync:: join;
9899use rustc_errors:: ErrorGuaranteed ;
99100use rustc_errors:: { DiagnosticMessage , SubdiagnosticMessage } ;
100101use rustc_fluent_macro:: fluent_messages;
@@ -236,20 +237,28 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
236237 } ) ;
237238 } ) ?;
238239
239- // NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.
240- tcx. sess . time ( "item_types_checking" , || {
241- tcx. hir ( ) . for_each_module ( |module| tcx. ensure ( ) . check_mod_item_types ( module) )
242- } ) ;
243-
244- // FIXME: Remove this when we implement creating `DefId`s
245- // for anon constants during their parents' typeck.
246- // Typeck all body owners in parallel will produce queries
247- // cycle errors because it may typeck on anon constants directly.
248- tcx. hir ( ) . par_body_owners ( |item_def_id| {
249- let def_kind = tcx. def_kind ( item_def_id) ;
250- if !matches ! ( def_kind, DefKind :: AnonConst ) {
251- tcx. ensure ( ) . typeck ( item_def_id) ;
252- }
240+ tcx. sess . time ( "item_types_and_item_bodies_checking" , || {
241+ join (
242+ || {
243+ // NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.
244+ tcx. sess . time ( "item_types_checking" , || {
245+ tcx. hir ( )
246+ . par_for_each_module ( |module| tcx. ensure ( ) . check_mod_item_types ( module) )
247+ } ) ;
248+ } ,
249+ || {
250+ // FIXME: Remove this when we implement creating `DefId`s
251+ // for anon constants during their parents' typeck.
252+ // Typeck all body owners in parallel will produce queries
253+ // cycle errors because it may typeck on anon constants directly.
254+ tcx. hir ( ) . par_body_owners ( |item_def_id| {
255+ let def_kind = tcx. def_kind ( item_def_id) ;
256+ if !matches ! ( def_kind, DefKind :: AnonConst ) {
257+ tcx. ensure ( ) . typeck ( item_def_id) ;
258+ }
259+ } ) ;
260+ } ,
261+ )
253262 } ) ;
254263
255264 tcx. ensure ( ) . check_unused_traits ( ( ) ) ;
0 commit comments