@@ -431,7 +431,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
431431 place_layout : TyLayout < ' tcx > ,
432432 source_info : SourceInfo ,
433433 place : & Place < ' tcx > ,
434- ) -> Option < Const < ' tcx > > {
434+ ) -> Option < ( ) > {
435435 let span = source_info. span ;
436436
437437 let overflow_check = self . tcx . sess . overflow_checks ( ) ;
@@ -553,7 +553,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
553553 self . use_ecx ( source_info, |this| {
554554 trace ! ( "calling eval_rvalue_into_place(rvalue = {:?}, place = {:?})" , rvalue, place) ;
555555 this. ecx . eval_rvalue_into_place ( rvalue, place) ?;
556- this . ecx . eval_place_to_op ( place , Some ( place_layout ) )
556+ Ok ( ( ) )
557557 } )
558558 }
559559
@@ -717,24 +717,23 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
717717 base : PlaceBase :: Local ( local) ,
718718 projection : box [ ] ,
719719 } = * place {
720- if let Some ( value) = self . const_prop ( rval,
721- place_layout,
722- statement. source_info ,
723- place) {
724- trace ! ( "checking whether {:?} can be stored to {:?}" , value, local) ;
720+ let source = statement. source_info ;
721+ if let Some ( ( ) ) = self . const_prop ( rval, place_layout, source, place) {
725722 if self . can_const_prop [ local] {
726- trace ! ( "stored {:?} to {:?}" , value, local) ;
727- assert_eq ! ( self . get_const( local) , Some ( value) ) ;
723+ trace ! ( "propagated into {:?}" , local) ;
728724
729725 if self . should_const_prop ( ) {
726+ let value =
727+ self . get_const ( local) . expect ( "local was dead/uninitialized" ) ;
728+ trace ! ( "replacing {:?} with {:?}" , rval, value) ;
730729 self . replace_with_const (
731730 rval,
732731 value,
733732 statement. source_info ,
734733 ) ;
735734 }
736735 } else {
737- trace ! ( "can't propagate {:?} to {:?}" , value , local) ;
736+ trace ! ( "can't propagate into {:?}" , local) ;
738737 self . remove_const ( local) ;
739738 }
740739 }
0 commit comments