@@ -431,7 +431,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
431
431
place_layout : TyLayout < ' tcx > ,
432
432
source_info : SourceInfo ,
433
433
place : & Place < ' tcx > ,
434
- ) -> Option < Const < ' tcx > > {
434
+ ) -> Option < ( ) > {
435
435
let span = source_info. span ;
436
436
437
437
let overflow_check = self . tcx . sess . overflow_checks ( ) ;
@@ -553,7 +553,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
553
553
self . use_ecx ( source_info, |this| {
554
554
trace ! ( "calling eval_rvalue_into_place(rvalue = {:?}, place = {:?})" , rvalue, place) ;
555
555
this. ecx . eval_rvalue_into_place ( rvalue, place) ?;
556
- this . ecx . eval_place_to_op ( place , Some ( place_layout ) )
556
+ Ok ( ( ) )
557
557
} )
558
558
}
559
559
@@ -717,24 +717,23 @@ impl<'mir, 'tcx> MutVisitor<'tcx> for ConstPropagator<'mir, 'tcx> {
717
717
base : PlaceBase :: Local ( local) ,
718
718
projection : box [ ] ,
719
719
} = * 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) {
725
722
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) ;
728
724
729
725
if self . should_const_prop ( ) {
726
+ let value =
727
+ self . get_const ( local) . expect ( "local was dead/uninitialized" ) ;
728
+ trace ! ( "replacing {:?} with {:?}" , rval, value) ;
730
729
self . replace_with_const (
731
730
rval,
732
731
value,
733
732
statement. source_info ,
734
733
) ;
735
734
}
736
735
} else {
737
- trace ! ( "can't propagate {:?} to {:?}" , value , local) ;
736
+ trace ! ( "can't propagate into {:?}" , local) ;
738
737
self . remove_const ( local) ;
739
738
}
740
739
}
0 commit comments