@@ -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
@@ -1181,8 +1179,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
11811179 ) -> InterpResult < ' tcx , OpTy < ' tcx , M :: Provenance > > {
11821180 M :: eval_mir_constant ( self , * val, span, layout, |ecx, val, span, layout| {
11831181 let const_val = val. eval ( * ecx. tcx , ecx. param_env , span) . map_err ( |err| {
1184- // FIXME: somehow this is reachable even when POST_MONO_CHECKS is on.
1185- // Are we not always populating `required_consts`?
1182+ if M :: all_required_consts_are_checked ( self )
1183+ && !matches ! ( err, ErrorHandled :: TooGeneric ( ..) )
1184+ {
1185+ // Looks like the const is not captued by `required_consts`, that's bad.
1186+ bug ! ( "interpret const eval failure of {val:?} which is not in required_consts" ) ;
1187+ }
11861188 err. emit_note ( * ecx. tcx ) ;
11871189 err
11881190 } ) ?;
0 commit comments