@@ -701,10 +701,7 @@ impl<'tcx> Body<'tcx> {
701
701
env,
702
702
crate :: ty:: EarlyBinder :: bind ( constant. const_ ) ,
703
703
) ;
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)
708
705
} ;
709
706
710
707
let TerminatorKind :: SwitchInt { discr, targets } = & block. terminator ( ) . kind else {
@@ -714,7 +711,7 @@ impl<'tcx> Body<'tcx> {
714
711
// If this is a SwitchInt(const _), then we can just evaluate the constant and return.
715
712
let discr = match discr {
716
713
Operand :: Constant ( constant) => {
717
- let bits = eval_mono_const ( constant) ;
714
+ let bits = eval_mono_const ( constant) ? ;
718
715
return Some ( ( bits, targets) ) ;
719
716
}
720
717
Operand :: Move ( place) | Operand :: Copy ( place) => place,
@@ -748,7 +745,7 @@ impl<'tcx> Body<'tcx> {
748
745
match rvalue {
749
746
Rvalue :: NullaryOp ( NullOp :: UbChecks , _) => Some ( ( tcx. sess . ub_checks ( ) as u128 , targets) ) ,
750
747
Rvalue :: Use ( Operand :: Constant ( constant) ) => {
751
- let bits = eval_mono_const ( constant) ;
748
+ let bits = eval_mono_const ( constant) ? ;
752
749
Some ( ( bits, targets) )
753
750
}
754
751
_ => None ,
0 commit comments