File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -245,11 +245,10 @@ impl<'tcx> Const<'tcx> {
245
245
match self {
246
246
Const :: Ty ( c) => match c. kind ( ) {
247
247
ty:: ConstKind :: Value ( _) => false , // already a value, cannot error
248
- ty:: ConstKind :: Param ( _) | ty:: ConstKind :: Error ( _) => true , // these are errors or could be replaced by errors
249
- _ => bug ! ( "is_required_const: unexpected ty::ConstKind {:#?}" , c) ,
248
+ _ => true ,
250
249
} ,
251
- Const :: Unevaluated ( ..) => true ,
252
250
Const :: Val ( ..) => false , // already a value, cannot error
251
+ Const :: Unevaluated ( ..) => true ,
253
252
}
254
253
}
255
254
Original file line number Diff line number Diff line change @@ -706,8 +706,12 @@ impl<'tcx> Inliner<'tcx> {
706
706
kind : TerminatorKind :: Goto { target : integrator. map_block ( START_BLOCK ) } ,
707
707
} ) ;
708
708
709
- // Copy required constants from the callee_body into the caller_body.
710
- caller_body. required_consts . extend ( callee_body. required_consts ) ;
709
+ // Copy required constants from the callee_body into the caller_body. Although we are only
710
+ // pushing unevaluated consts to `required_consts`, here they may have been evaluated
711
+ // because we are calling `instantiate_and_normalize_erasing_regions` -- so we filter again.
712
+ caller_body. required_consts . extend (
713
+ callee_body. required_consts . into_iter ( ) . filter ( |ct| ct. const_ . is_required_const ( ) ) ,
714
+ ) ;
711
715
// Now that we incorporated the callee's `required_consts`, we can remove the callee from
712
716
// `mentioned_items` -- but we have to take their `mentioned_items` in return. This does
713
717
// some extra work here to save the monomorphization collector work later. It helps a lot,
You can’t perform that action at this time.
0 commit comments