@@ -1162,15 +1162,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1162
1162
if should_encode_type ( tcx, local_id, def_kind) {
1163
1163
record ! ( self . tables. type_of[ def_id] <- self . tcx. type_of( def_id) ) ;
1164
1164
}
1165
- if should_encode_const ( def_kind) && tcx. is_mir_available ( def_id) {
1166
- let qualifs = tcx. at ( def_span) . mir_const_qualif ( def_id) ;
1167
- record ! ( self . tables. mir_const_qualif[ def_id] <- qualifs) ;
1168
- let body_id = tcx. hir ( ) . maybe_body_owned_by ( local_id) ;
1169
- if let Some ( body_id) = body_id {
1170
- let const_data = self . encode_rendered_const_for_body ( body_id) ;
1171
- record ! ( self . tables. rendered_const[ def_id] <- const_data) ;
1172
- }
1173
- }
1174
1165
if let DefKind :: TyParam | DefKind :: ConstParam = def_kind {
1175
1166
if let Some ( default) = self . tcx . object_lifetime_default ( def_id) {
1176
1167
record ! ( self . tables. object_lifetime_default[ def_id] <- default ) ;
@@ -1385,12 +1376,13 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1385
1376
return ;
1386
1377
}
1387
1378
1388
- let keys_and_jobs = self
1389
- . tcx
1379
+ let tcx = self . tcx ;
1380
+
1381
+ let keys_and_jobs = tcx
1390
1382
. mir_keys ( ( ) )
1391
1383
. iter ( )
1392
1384
. filter_map ( |& def_id| {
1393
- let ( encode_const, encode_opt) = should_encode_mir ( self . tcx , def_id) ;
1385
+ let ( encode_const, encode_opt) = should_encode_mir ( tcx, def_id) ;
1394
1386
if encode_const || encode_opt {
1395
1387
Some ( ( def_id, encode_const, encode_opt) )
1396
1388
} else {
@@ -1403,22 +1395,32 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
1403
1395
1404
1396
debug ! ( "EntryBuilder::encode_mir({:?})" , def_id) ;
1405
1397
if encode_opt {
1406
- record ! ( self . tables. optimized_mir[ def_id. to_def_id( ) ] <- self . tcx. optimized_mir( def_id) ) ;
1398
+ record ! ( self . tables. optimized_mir[ def_id. to_def_id( ) ] <- tcx. optimized_mir( def_id) ) ;
1407
1399
}
1408
1400
if encode_const {
1409
- record ! ( self . tables. mir_for_ctfe[ def_id. to_def_id( ) ] <- self . tcx. mir_for_ctfe( def_id) ) ;
1401
+ record ! ( self . tables. mir_for_ctfe[ def_id. to_def_id( ) ] <- tcx. mir_for_ctfe( def_id) ) ;
1410
1402
1411
1403
// FIXME(generic_const_exprs): this feels wrong to have in `encode_mir`
1412
- let abstract_const = self . tcx . thir_abstract_const ( def_id) ;
1404
+ let abstract_const = tcx. thir_abstract_const ( def_id) ;
1413
1405
if let Ok ( Some ( abstract_const) ) = abstract_const {
1414
1406
record ! ( self . tables. thir_abstract_const[ def_id. to_def_id( ) ] <- abstract_const) ;
1415
1407
}
1408
+
1409
+ if should_encode_const ( tcx. def_kind ( def_id) ) {
1410
+ let qualifs = tcx. mir_const_qualif ( def_id) ;
1411
+ record ! ( self . tables. mir_const_qualif[ def_id. to_def_id( ) ] <- qualifs) ;
1412
+ let body_id = tcx. hir ( ) . maybe_body_owned_by ( def_id) ;
1413
+ if let Some ( body_id) = body_id {
1414
+ let const_data = self . encode_rendered_const_for_body ( body_id) ;
1415
+ record ! ( self . tables. rendered_const[ def_id. to_def_id( ) ] <- const_data) ;
1416
+ }
1417
+ }
1416
1418
}
1417
- record ! ( self . tables. promoted_mir[ def_id. to_def_id( ) ] <- self . tcx. promoted_mir( def_id) ) ;
1419
+ record ! ( self . tables. promoted_mir[ def_id. to_def_id( ) ] <- tcx. promoted_mir( def_id) ) ;
1418
1420
1419
1421
let instance =
1420
1422
ty:: InstanceDef :: Item ( ty:: WithOptConstParam :: unknown ( def_id. to_def_id ( ) ) ) ;
1421
- let unused = self . tcx . unused_generic_params ( instance) ;
1423
+ let unused = tcx. unused_generic_params ( instance) ;
1422
1424
if !unused. is_empty ( ) {
1423
1425
record ! ( self . tables. unused_generic_params[ def_id. to_def_id( ) ] <- unused) ;
1424
1426
}
0 commit comments