File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 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> {
245245 match self {
246246 Const :: Ty ( c) => match c. kind ( ) {
247247 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 ,
250249 } ,
251- Const :: Unevaluated ( ..) => true ,
252250 Const :: Val ( ..) => false , // already a value, cannot error
251+ Const :: Unevaluated ( ..) => true ,
253252 }
254253 }
255254
Original file line number Diff line number Diff line change @@ -720,8 +720,12 @@ impl<'tcx> Inliner<'tcx> {
720720 kind : TerminatorKind :: Goto { target : integrator. map_block ( START_BLOCK ) } ,
721721 } ) ;
722722
723- // Copy required constants from the callee_body into the caller_body.
724- caller_body. required_consts . extend ( callee_body. required_consts ) ;
723+ // Copy required constants from the callee_body into the caller_body. Although we are only
724+ // pushing unevaluated consts to `required_consts`, here they may have been evaluated
725+ // because we are calling `instantiate_and_normalize_erasing_regions` -- so we filter again.
726+ caller_body. required_consts . extend (
727+ callee_body. required_consts . into_iter ( ) . filter ( |ct| ct. const_ . is_required_const ( ) ) ,
728+ ) ;
725729 // Now that we incorporated the callee's `required_consts`, we can remove the callee from
726730 // `mentioned_items` -- but we have to take their `mentioned_items` in return. This does
727731 // 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