@@ -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;
@@ -212,26 +213,33 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
212
213
} ) ;
213
214
} ) ?;
214
215
215
- // NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.
216
- tcx. sess . time ( "item_types_checking" , || {
217
- tcx. hir ( ) . for_each_module ( |module| tcx. ensure ( ) . check_mod_item_types ( module) )
216
+ tcx. sess . time ( "item_types_and_item_bodies_checking" , || {
217
+ join (
218
+ || {
219
+ // NOTE: This is copy/pasted in librustdoc/core.rs and should be kept in sync.
220
+ tcx. sess . time ( "item_types_checking" , || {
221
+ tcx. hir ( )
222
+ . par_for_each_module ( |module| tcx. ensure ( ) . check_mod_item_types ( module) )
223
+ } ) ;
224
+ } ,
225
+ || {
226
+ // FIXME: Remove this when we implement creating `DefId`s
227
+ // for anon constants during their parents' typeck.
228
+ // Typeck all body owners in parallel will produce queries
229
+ // cycle errors because it may typeck on anon constants directly.
230
+ tcx. hir ( ) . par_body_owners ( |item_def_id| {
231
+ let def_kind = tcx. def_kind ( item_def_id) ;
232
+ if !matches ! ( def_kind, DefKind :: AnonConst ) {
233
+ tcx. ensure ( ) . typeck ( item_def_id) ;
234
+ }
235
+ } ) ;
236
+ } ,
237
+ )
218
238
} ) ;
219
239
220
240
// Freeze definitions as we don't add new ones at this point. This improves performance by
221
241
// allowing lock-free access to them.
222
242
tcx. untracked ( ) . definitions . freeze ( ) ;
223
-
224
- // FIXME: Remove this when we implement creating `DefId`s
225
- // for anon constants during their parents' typeck.
226
- // Typeck all body owners in parallel will produce queries
227
- // cycle errors because it may typeck on anon constants directly.
228
- tcx. hir ( ) . par_body_owners ( |item_def_id| {
229
- let def_kind = tcx. def_kind ( item_def_id) ;
230
- if !matches ! ( def_kind, DefKind :: AnonConst ) {
231
- tcx. ensure ( ) . typeck ( item_def_id) ;
232
- }
233
- } ) ;
234
-
235
243
tcx. ensure ( ) . check_unused_traits ( ( ) ) ;
236
244
237
245
if let Some ( reported) = tcx. sess . has_errors ( ) { Err ( reported) } else { Ok ( ( ) ) }
0 commit comments