@@ -1236,39 +1236,37 @@ impl EncodeContext<'a, 'tcx> {
1236
1236
return ;
1237
1237
}
1238
1238
1239
- let mut keys_and_jobs = self
1240
- . tcx
1239
+ let tcx = self . tcx ;
1240
+ let keys_and_jobs = tcx
1241
1241
. mir_keys ( LOCAL_CRATE )
1242
- . iter ( )
1242
+ . to_sorted_vec ( )
1243
+ . into_iter ( )
1243
1244
. filter_map ( |& def_id| {
1244
- let ( encode_const, encode_opt) = should_encode_mir ( self . tcx , def_id) ;
1245
- if encode_const || encode_opt {
1246
- Some ( ( def_id, encode_const, encode_opt) )
1247
- } else {
1248
- None
1249
- }
1250
- } )
1251
- . collect :: < Vec < _ > > ( ) ;
1252
- // Sort everything to ensure a stable order for diagnotics.
1253
- keys_and_jobs. sort_by_key ( |& ( def_id, _, _) | def_id) ;
1254
- for ( def_id, encode_const, encode_opt) in keys_and_jobs. into_iter ( ) {
1245
+ let ( encode_const, encode_opt) = should_encode_mir ( tcx, def_id) ;
1246
+ if encode_const || encode_opt {
1247
+ Some ( ( def_id, encode_const, encode_opt) )
1248
+ } else {
1249
+ None
1250
+ }
1251
+ } ) ;
1252
+ for ( def_id, encode_const, encode_opt) in keys_and_jobs {
1255
1253
debug_assert ! ( encode_const || encode_opt) ;
1256
1254
1257
1255
debug ! ( "EntryBuilder::encode_mir({:?})" , def_id) ;
1258
1256
if encode_opt {
1259
- record ! ( self . tables. mir[ def_id. to_def_id( ) ] <- self . tcx. optimized_mir( def_id) ) ;
1257
+ record ! ( self . tables. mir[ def_id. to_def_id( ) ] <- tcx. optimized_mir( def_id) ) ;
1260
1258
}
1261
1259
if encode_const {
1262
- record ! ( self . tables. mir_for_ctfe[ def_id. to_def_id( ) ] <- self . tcx. mir_for_ctfe( def_id) ) ;
1260
+ record ! ( self . tables. mir_for_ctfe[ def_id. to_def_id( ) ] <- tcx. mir_for_ctfe( def_id) ) ;
1263
1261
1264
- let abstract_const = self . tcx . mir_abstract_const ( def_id) ;
1262
+ let abstract_const = tcx. mir_abstract_const ( def_id) ;
1265
1263
if let Ok ( Some ( abstract_const) ) = abstract_const {
1266
1264
record ! ( self . tables. mir_abstract_consts[ def_id. to_def_id( ) ] <- abstract_const) ;
1267
1265
}
1268
1266
}
1269
- record ! ( self . tables. promoted_mir[ def_id. to_def_id( ) ] <- self . tcx. promoted_mir( def_id) ) ;
1267
+ record ! ( self . tables. promoted_mir[ def_id. to_def_id( ) ] <- tcx. promoted_mir( def_id) ) ;
1270
1268
1271
- let unused = self . tcx . unused_generic_params ( def_id) ;
1269
+ let unused = tcx. unused_generic_params ( def_id) ;
1272
1270
if !unused. is_empty ( ) {
1273
1271
record ! ( self . tables. unused_generic_params[ def_id. to_def_id( ) ] <- unused) ;
1274
1272
}
@@ -1997,7 +1995,7 @@ fn prefetch_mir(tcx: TyCtxt<'_>) {
1997
1995
return ;
1998
1996
}
1999
1997
2000
- par_iter ( tcx. mir_keys ( LOCAL_CRATE ) ) . for_each ( |& def_id| {
1998
+ par_iter ( tcx. mir_keys ( LOCAL_CRATE ) . to_sorted_vec ( ) ) . for_each ( |& def_id| {
2001
1999
let ( encode_const, encode_opt) = should_encode_mir ( tcx, def_id) ;
2002
2000
2003
2001
if encode_const {
0 commit comments