@@ -21,7 +21,7 @@ use rustc_borrowck as borrowck;
21
21
use rustc_codegen_utils:: codegen_backend:: CodegenBackend ;
22
22
use rustc_data_structures:: fingerprint:: Fingerprint ;
23
23
use rustc_data_structures:: stable_hasher:: StableHasher ;
24
- use rustc_data_structures:: sync:: Lrc ;
24
+ use rustc_data_structures:: sync:: { Lrc , ParallelIterator , par_iter } ;
25
25
use rustc_incremental;
26
26
use rustc_metadata:: creader:: CrateLoader ;
27
27
use rustc_metadata:: cstore:: { self , CStore } ;
@@ -191,51 +191,50 @@ fn analysis<'tcx>(
191
191
192
192
let sess = tcx. sess ;
193
193
194
- parallel ! ( {
195
- time( sess, "looking for entry point" , || {
196
- middle:: entry:: find_entry_point( tcx)
197
- } ) ;
194
+ time ( sess, "misc checking 1" , || {
195
+ parallel ! ( {
196
+ time( sess, "looking for entry point" , || {
197
+ middle:: entry:: find_entry_point( tcx)
198
+ } ) ;
198
199
199
- time( sess, "looking for plugin registrar" , || {
200
- plugin:: build:: find_plugin_registrar( tcx)
201
- } ) ;
200
+ time( sess, "looking for plugin registrar" , || {
201
+ plugin:: build:: find_plugin_registrar( tcx)
202
+ } ) ;
202
203
203
- time( sess, "looking for derive registrar" , || {
204
- proc_macro_decls:: find( tcx)
205
- } ) ;
206
- } , {
207
- time( sess, "loop checking" , || loops:: check_crate( tcx) ) ;
208
- } , {
209
- time( sess, "attribute checking" , || {
210
- hir:: check_attr:: check_crate( tcx)
211
- } ) ;
212
- } , {
213
- time( sess, "stability checking" , || {
214
- stability:: check_unstable_api_usage( tcx)
204
+ time( sess, "looking for derive registrar" , || {
205
+ proc_macro_decls:: find( tcx)
206
+ } ) ;
207
+ } , {
208
+ par_iter( & tcx. hir( ) . krate( ) . modules) . for_each( |( & module, _) | {
209
+ tcx. ensure( ) . check_mod_loops( tcx. hir( ) . local_def_id( module) ) ;
210
+ tcx. ensure( ) . check_mod_attrs( tcx. hir( ) . local_def_id( module) ) ;
211
+ tcx. ensure( ) . check_mod_unstable_api_usage( tcx. hir( ) . local_def_id( module) ) ;
212
+ } ) ;
215
213
} ) ;
216
214
} ) ;
217
215
218
216
// passes are timed inside typeck
219
217
typeck:: check_crate ( tcx) ?;
220
218
221
- time ( sess, "misc checking" , || {
219
+ time ( sess, "misc checking 2 " , || {
222
220
parallel ! ( {
223
- time( sess, "rvalue promotion" , || {
224
- rvalue_promotion:: check_crate( tcx)
225
- } ) ;
226
- } , {
227
- time( sess, "intrinsic checking" , || {
228
- middle:: intrinsicck:: check_crate( tcx)
221
+ time( sess, "rvalue promotion + match checking" , || {
222
+ tcx. par_body_owners( |def_id| {
223
+ tcx. ensure( ) . const_is_rvalue_promotable_to_static( def_id) ;
224
+ tcx. ensure( ) . check_match( def_id) ;
225
+ } ) ;
229
226
} ) ;
230
227
} , {
231
- time( sess, "match checking" , || mir:: matchck_crate( tcx) ) ;
232
- } , {
233
- // this must run before MIR dump, because
234
- // "not all control paths return a value" is reported here.
235
- //
236
- // maybe move the check to a MIR pass?
237
- time( sess, "liveness checking" , || {
238
- middle:: liveness:: check_crate( tcx)
228
+ time( sess, "liveness checking + intrinsic checking" , || {
229
+ par_iter( & tcx. hir( ) . krate( ) . modules) . for_each( |( & module, _) | {
230
+ // this must run before MIR dump, because
231
+ // "not all control paths return a value" is reported here.
232
+ //
233
+ // maybe move the check to a MIR pass?
234
+ tcx. ensure( ) . check_mod_liveness( tcx. hir( ) . local_def_id( module) ) ;
235
+
236
+ tcx. ensure( ) . check_mod_intrinsics( tcx. hir( ) . local_def_id( module) ) ;
237
+ } ) ;
239
238
} ) ;
240
239
} ) ;
241
240
} ) ;
@@ -276,19 +275,30 @@ fn analysis<'tcx>(
276
275
return Err ( ErrorReported ) ;
277
276
}
278
277
279
- time ( sess, "misc checking" , || {
278
+ time ( sess, "misc checking 3 " , || {
280
279
parallel ! ( {
281
- time( sess, "privacy checking " , || {
282
- rustc_privacy :: check_crate ( tcx)
280
+ time( sess, "privacy access levels " , || {
281
+ tcx. ensure ( ) . privacy_access_levels ( LOCAL_CRATE ) ;
283
282
} ) ;
284
- } , {
285
- time( sess, "death checking" , || middle:: dead:: check_crate( tcx) ) ;
286
- } , {
287
- time( sess, "unused lib feature checking" , || {
288
- stability:: check_unused_or_stable_features( tcx)
283
+ parallel!( {
284
+ time( sess, "private in public" , || {
285
+ tcx. ensure( ) . check_private_in_public( LOCAL_CRATE ) ;
286
+ } ) ;
287
+ } , {
288
+ time( sess, "death checking" , || middle:: dead:: check_crate( tcx) ) ;
289
+ } , {
290
+ time( sess, "unused lib feature checking" , || {
291
+ stability:: check_unused_or_stable_features( tcx)
292
+ } ) ;
293
+ } , {
294
+ time( sess, "lint checking" , || lint:: check_crate( tcx) ) ;
289
295
} ) ;
290
296
} , {
291
- time( sess, "lint checking" , || lint:: check_crate( tcx) ) ;
297
+ time( sess, "privacy checking modules" , || {
298
+ par_iter( & tcx. hir( ) . krate( ) . modules) . for_each( |( & module, _) | {
299
+ tcx. ensure( ) . check_mod_privacy( tcx. hir( ) . local_def_id( module) ) ;
300
+ } ) ;
301
+ } ) ;
292
302
} ) ;
293
303
} ) ;
294
304
0 commit comments