@@ -404,32 +404,15 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
404404 let r = match f ( self ) {
405405 Ok ( val) => Some ( val) ,
406406 Err ( error) => {
407- use rustc:: mir:: interpret:: {
408- InterpError :: * , UndefinedBehaviorInfo , UnsupportedOpInfo ,
409- } ;
410- match error. kind {
411- MachineStop ( _) => bug ! ( "ConstProp does not stop" ) ,
412-
413- // Some error shouldn't come up because creating them causes
414- // an allocation, which we should avoid. When that happens,
415- // dedicated error variants should be introduced instead.
416- // Only test this in debug builds though to avoid disruptions.
417- Unsupported ( UnsupportedOpInfo :: Unsupported ( _) )
418- | Unsupported ( UnsupportedOpInfo :: ValidationFailure ( _) )
419- | UndefinedBehavior ( UndefinedBehaviorInfo :: Ub ( _) )
420- | UndefinedBehavior ( UndefinedBehaviorInfo :: UbExperimental ( _) )
421- if cfg ! ( debug_assertions) =>
422- {
423- bug ! ( "const-prop encountered allocating error: {:?}" , error. kind) ;
424- }
425-
426- Unsupported ( _)
427- | UndefinedBehavior ( _)
428- | InvalidProgram ( _)
429- | ResourceExhaustion ( _) => {
430- // Ignore these errors.
431- }
432- }
407+ // Some errors shouldn't come up because creating them causes
408+ // an allocation, which we should avoid. When that happens,
409+ // dedicated error variants should be introduced instead.
410+ // Only test this in debug builds though to avoid disruptions.
411+ debug_assert ! (
412+ !error. kind. allocates( ) ,
413+ "const-prop encountered allocating error: {}" ,
414+ error
415+ ) ;
433416 None
434417 }
435418 } ;
0 commit comments