@@ -1004,14 +1004,6 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
10041004                    let  expected = ScalarMaybeUninit :: from ( Scalar :: from_bool ( * expected) ) ; 
10051005                    let  value_const = self . ecx . read_scalar ( value) . unwrap ( ) ; 
10061006                    if  expected != value_const { 
1007-                         // Poison all places this operand references so that further code 
1008-                         // doesn't use the invalid value 
1009-                         match  cond { 
1010-                             Operand :: Move ( ref  place)  | Operand :: Copy ( ref  place)  => { 
1011-                                 Self :: remove_const ( & mut  self . ecx ,  place. local ) ; 
1012-                             } 
1013-                             Operand :: Constant ( _)  => { } 
1014-                         } 
10151007                        let  mut  eval_to_int = |op| { 
10161008                            let  op = self 
10171009                                . eval_operand ( op,  source_info) 
@@ -1020,27 +1012,37 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
10201012                        } ; 
10211013                        let  msg = match  msg { 
10221014                            AssertKind :: DivisionByZero ( op)  => { 
1023-                                 AssertKind :: DivisionByZero ( eval_to_int ( op) ) 
1015+                                 Some ( AssertKind :: DivisionByZero ( eval_to_int ( op) ) ) 
10241016                            } 
10251017                            AssertKind :: RemainderByZero ( op)  => { 
1026-                                 AssertKind :: RemainderByZero ( eval_to_int ( op) ) 
1018+                                 Some ( AssertKind :: RemainderByZero ( eval_to_int ( op) ) ) 
10271019                            } 
10281020                            AssertKind :: BoundsCheck  {  ref  len,  ref  index }  => { 
10291021                                let  len = eval_to_int ( len) ; 
10301022                                let  index = eval_to_int ( index) ; 
1031-                                 AssertKind :: BoundsCheck  {  len,  index } 
1023+                                 Some ( AssertKind :: BoundsCheck  {  len,  index } ) 
10321024                            } 
10331025                            // Overflow is are already covered by checks on the binary operators. 
1034-                             AssertKind :: Overflow ( ..)  | AssertKind :: OverflowNeg ( _)  => return , 
1026+                             AssertKind :: Overflow ( ..)  | AssertKind :: OverflowNeg ( _)  => None , 
10351027                            // Need proper const propagator for these. 
1036-                             _ => return , 
1028+                             _ => None , 
10371029                        } ; 
1038-                         self . report_assert_as_lint ( 
1039-                             lint:: builtin:: UNCONDITIONAL_PANIC , 
1040-                             source_info, 
1041-                             "this operation will panic at runtime" , 
1042-                             msg, 
1043-                         ) ; 
1030+                         // Poison all places this operand references so that further code 
1031+                         // doesn't use the invalid value 
1032+                         match  cond { 
1033+                             Operand :: Move ( ref  place)  | Operand :: Copy ( ref  place)  => { 
1034+                                 Self :: remove_const ( & mut  self . ecx ,  place. local ) ; 
1035+                             } 
1036+                             Operand :: Constant ( _)  => { } 
1037+                         } 
1038+                         if  let  Some ( msg)  = msg { 
1039+                             self . report_assert_as_lint ( 
1040+                                 lint:: builtin:: UNCONDITIONAL_PANIC , 
1041+                                 source_info, 
1042+                                 "this operation will panic at runtime" , 
1043+                                 msg, 
1044+                             ) ; 
1045+                         } 
10441046                    }  else  { 
10451047                        if  self . should_const_prop ( value)  { 
10461048                            if  let  ScalarMaybeUninit :: Scalar ( scalar)  = value_const { 
0 commit comments