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 @@ -706,8 +706,12 @@ impl<'tcx> Inliner<'tcx> {
706706 kind : TerminatorKind :: Goto { target : integrator. map_block ( START_BLOCK ) } ,
707707 } ) ;
708708
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+ ) ;
711715 // Now that we incorporated the callee's `required_consts`, we can remove the callee from
712716 // `mentioned_items` -- but we have to take their `mentioned_items` in return. This does
713717 // 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