@@ -822,15 +822,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
822822 self . stack_mut ( ) . push ( frame) ;
823823
824824 // Make sure all the constants required by this frame evaluate successfully (post-monomorphization check).
825- if M :: POST_MONO_CHECKS {
826- for & const_ in & body. required_consts {
827- let c = self
828- . instantiate_from_current_frame_and_normalize_erasing_regions ( const_. const_ ) ?;
829- c. eval ( * self . tcx , self . param_env , const_. span ) . map_err ( |err| {
830- err. emit_note ( * self . tcx ) ;
831- err
832- } ) ?;
833- }
825+ for & const_ in & body. required_consts {
826+ let c =
827+ self . instantiate_from_current_frame_and_normalize_erasing_regions ( const_. const_ ) ?;
828+ c. eval ( * self . tcx , self . param_env , const_. span ) . map_err ( |err| {
829+ err. emit_note ( * self . tcx ) ;
830+ err
831+ } ) ?;
834832 }
835833
836834 // done
@@ -1179,8 +1177,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
11791177 ) -> InterpResult < ' tcx , OpTy < ' tcx , M :: Provenance > > {
11801178 M :: eval_mir_constant ( self , * val, span, layout, |ecx, val, span, layout| {
11811179 let const_val = val. eval ( * ecx. tcx , ecx. param_env , span) . map_err ( |err| {
1182- // FIXME: somehow this is reachable even when POST_MONO_CHECKS is on.
1183- // Are we not always populating `required_consts`?
1180+ if M :: all_required_consts_are_checked ( self )
1181+ && !matches ! ( err, ErrorHandled :: TooGeneric ( ..) )
1182+ {
1183+ // Looks like the const is not captued by `required_consts`, that's bad.
1184+ bug ! ( "interpret const eval failure of {val:?} which is not in required_consts" ) ;
1185+ }
11841186 err. emit_note ( * ecx. tcx ) ;
11851187 err
11861188 } ) ?;
0 commit comments