@@ -591,8 +591,8 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> {
591
591
if let TerminatorKind :: Assert { expected, msg, cond, .. } = kind {
592
592
if let Some ( value) = self . eval_operand ( cond, source_info) {
593
593
trace ! ( "assertion on {:?} should be {:?}" , value, expected) ;
594
- let expected = Immediate :: Scalar ( Scalar :: from_bool ( * expected) . into ( ) ) ;
595
- if expected != value. 0 . to_immediate ( ) {
594
+ let expected = ScalarMaybeUndef :: from ( Scalar :: from_bool ( * expected) ) ;
595
+ if expected != self . ecx . read_scalar ( value. 0 ) . unwrap ( ) {
596
596
// poison all places this operand references so that further code
597
597
// doesn't use the invalid value
598
598
match cond {
@@ -628,20 +628,20 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> {
628
628
let len = self
629
629
. eval_operand ( len, source_info)
630
630
. expect ( "len must be const" ) ;
631
- let len = match len . 0 . to_immediate ( ) {
632
- Immediate :: Scalar ( ScalarMaybeUndef :: Scalar ( Scalar :: Bits {
631
+ let len = match self . ecx . read_scalar ( len . 0 ) {
632
+ Ok ( ScalarMaybeUndef :: Scalar ( Scalar :: Bits {
633
633
bits, ..
634
634
} ) ) => bits,
635
- _ => bug ! ( "const len not primitive: {:?}" , len ) ,
635
+ other => bug ! ( "const len not primitive: {:?}" , other ) ,
636
636
} ;
637
637
let index = self
638
638
. eval_operand ( index, source_info)
639
639
. expect ( "index must be const" ) ;
640
- let index = match index . 0 . to_immediate ( ) {
641
- Immediate :: Scalar ( ScalarMaybeUndef :: Scalar ( Scalar :: Bits {
640
+ let index = match self . ecx . read_scalar ( index . 0 ) {
641
+ Ok ( ScalarMaybeUndef :: Scalar ( Scalar :: Bits {
642
642
bits, ..
643
643
} ) ) => bits,
644
- _ => bug ! ( "const index not primitive: {:?}" , index ) ,
644
+ other => bug ! ( "const index not primitive: {:?}" , other ) ,
645
645
} ;
646
646
format ! (
647
647
"index out of bounds: \
0 commit comments