File tree 1 file changed +18
-5
lines changed
compiler/rustc_metadata/src/rmeta
1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change @@ -1185,11 +1185,24 @@ impl EncodeContext<'a, 'tcx> {
1185
1185
if self . is_proc_macro {
1186
1186
return ;
1187
1187
}
1188
- for & def_id in self . tcx . mir_keys ( LOCAL_CRATE ) . iter ( ) {
1189
- let ( encode_const, encode_opt) = should_encode_mir ( self . tcx , def_id) ;
1190
- if !encode_const && !encode_opt {
1191
- continue ;
1192
- }
1188
+
1189
+ let mut keys_and_jobs = self
1190
+ . tcx
1191
+ . mir_keys ( LOCAL_CRATE )
1192
+ . iter ( )
1193
+ . filter_map ( |& def_id| {
1194
+ let ( encode_const, encode_opt) = should_encode_mir ( self . tcx , def_id) ;
1195
+ if encode_const || encode_opt {
1196
+ Some ( ( def_id, encode_const, encode_opt) )
1197
+ } else {
1198
+ None
1199
+ }
1200
+ } )
1201
+ . collect :: < Vec < _ > > ( ) ;
1202
+ // Sort everything to ensure a stable order for diagnotics.
1203
+ keys_and_jobs. sort_by_key ( |& ( def_id, _, _) | def_id) ;
1204
+ for ( def_id, encode_const, encode_opt) in keys_and_jobs. into_iter ( ) {
1205
+ debug_assert ! ( encode_const || encode_opt) ;
1193
1206
1194
1207
debug ! ( "EntryBuilder::encode_mir({:?})" , def_id) ;
1195
1208
if encode_opt {
You can’t perform that action at this time.
0 commit comments