@@ -701,10 +701,7 @@ impl<'tcx> Body<'tcx> {
701701 env,
702702 crate :: ty:: EarlyBinder :: bind ( constant. const_ ) ,
703703 ) ;
704- let Some ( bits) = mono_literal. try_eval_bits ( tcx, env) else {
705- bug ! ( "Couldn't evaluate constant {:?} in mono {:?}" , constant, instance) ;
706- } ;
707- bits
704+ mono_literal. try_eval_bits ( tcx, env)
708705 } ;
709706
710707 let TerminatorKind :: SwitchInt { discr, targets } = & block. terminator ( ) . kind else {
@@ -714,7 +711,7 @@ impl<'tcx> Body<'tcx> {
714711 // If this is a SwitchInt(const _), then we can just evaluate the constant and return.
715712 let discr = match discr {
716713 Operand :: Constant ( constant) => {
717- let bits = eval_mono_const ( constant) ;
714+ let bits = eval_mono_const ( constant) ? ;
718715 return Some ( ( bits, targets) ) ;
719716 }
720717 Operand :: Move ( place) | Operand :: Copy ( place) => place,
@@ -748,7 +745,7 @@ impl<'tcx> Body<'tcx> {
748745 match rvalue {
749746 Rvalue :: NullaryOp ( NullOp :: UbChecks , _) => Some ( ( tcx. sess . ub_checks ( ) as u128 , targets) ) ,
750747 Rvalue :: Use ( Operand :: Constant ( constant) ) => {
751- let bits = eval_mono_const ( constant) ;
748+ let bits = eval_mono_const ( constant) ? ;
752749 Some ( ( bits, targets) )
753750 }
754751 _ => None ,
0 commit comments