@@ -591,8 +591,8 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> {
591591 if let TerminatorKind :: Assert { expected, msg, cond, .. } = kind {
592592 if let Some ( value) = self . eval_operand ( cond, source_info) {
593593 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 ( ) {
596596 // poison all places this operand references so that further code
597597 // doesn't use the invalid value
598598 match cond {
@@ -628,20 +628,20 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for ConstPropagator<'b, 'a, 'tcx> {
628628 let len = self
629629 . eval_operand ( len, source_info)
630630 . 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 {
633633 bits, ..
634634 } ) ) => bits,
635- _ => bug ! ( "const len not primitive: {:?}" , len ) ,
635+ other => bug ! ( "const len not primitive: {:?}" , other ) ,
636636 } ;
637637 let index = self
638638 . eval_operand ( index, source_info)
639639 . 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 {
642642 bits, ..
643643 } ) ) => bits,
644- _ => bug ! ( "const index not primitive: {:?}" , index ) ,
644+ other => bug ! ( "const index not primitive: {:?}" , other ) ,
645645 } ;
646646 format ! (
647647 "index out of bounds: \
0 commit comments