@@ -792,15 +792,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
792792 self . stack_mut ( ) . push ( frame) ;
793793
794794 // Make sure all the constants required by this frame evaluate successfully (post-monomorphization check).
795- if M :: POST_MONO_CHECKS {
796- for & const_ in & body. required_consts {
797- let c = self
798- . instantiate_from_current_frame_and_normalize_erasing_regions ( const_. const_ ) ?;
799- c. eval ( * self . tcx , self . param_env , Some ( const_. span ) ) . map_err ( |err| {
800- err. emit_note ( * self . tcx ) ;
801- err
802- } ) ?;
803- }
795+ for & const_ in & body. required_consts {
796+ let c =
797+ self . instantiate_from_current_frame_and_normalize_erasing_regions ( const_. const_ ) ?;
798+ c. eval ( * self . tcx , self . param_env , Some ( const_. span ) ) . map_err ( |err| {
799+ err. emit_note ( * self . tcx ) ;
800+ err
801+ } ) ?;
804802 }
805803
806804 // done
@@ -1149,8 +1147,12 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
11491147 ) -> InterpResult < ' tcx , OpTy < ' tcx , M :: Provenance > > {
11501148 M :: eval_mir_constant ( self , * val, span, layout, |ecx, val, span, layout| {
11511149 let const_val = val. eval ( * ecx. tcx , ecx. param_env , span) . map_err ( |err| {
1152- // FIXME: somehow this is reachable even when POST_MONO_CHECKS is on.
1153- // Are we not always populating `required_consts`?
1150+ if M :: all_required_consts_are_checked ( self )
1151+ && !matches ! ( err, ErrorHandled :: TooGeneric ( ..) )
1152+ {
1153+ // Looks like the const is not captued by `required_consts`, that's bad.
1154+ bug ! ( "interpret const eval failure of {val:?} which is not in required_consts" ) ;
1155+ }
11541156 err. emit_note ( * ecx. tcx ) ;
11551157 err
11561158 } ) ?;
0 commit comments