@@ -95,6 +95,7 @@ mod outlives;
95
95
pub mod structured_errors;
96
96
mod variance;
97
97
98
+ use rustc_data_structures:: sync:: join;
98
99
use rustc_errors:: ErrorGuaranteed ;
99
100
use rustc_errors:: { DiagnosticMessage , SubdiagnosticMessage } ;
100
101
use rustc_fluent_macro:: fluent_messages;
@@ -236,26 +237,33 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
236
237
} ) ;
237
238
} ) ?;
238
239
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) )
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
+ )
242
262
} ) ;
243
263
244
264
// Freeze definitions as we don't add new ones at this point. This improves performance by
245
265
// allowing lock-free access to them.
246
266
tcx. untracked ( ) . definitions . freeze ( ) ;
247
-
248
- // FIXME: Remove this when we implement creating `DefId`s
249
- // for anon constants during their parents' typeck.
250
- // Typeck all body owners in parallel will produce queries
251
- // cycle errors because it may typeck on anon constants directly.
252
- tcx. hir ( ) . par_body_owners ( |item_def_id| {
253
- let def_kind = tcx. def_kind ( item_def_id) ;
254
- if !matches ! ( def_kind, DefKind :: AnonConst ) {
255
- tcx. ensure ( ) . typeck ( item_def_id) ;
256
- }
257
- } ) ;
258
-
259
267
tcx. ensure ( ) . check_unused_traits ( ( ) ) ;
260
268
261
269
if let Some ( reported) = tcx. sess . has_errors ( ) { Err ( reported) } else { Ok ( ( ) ) }
0 commit comments