@@ -562,7 +562,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
562
562
/// if can_go then succ else drop-block
563
563
/// drop-block:
564
564
/// if ptr_based {
565
- /// ptr = cur
565
+ /// ptr = &mut * cur
566
566
/// cur = cur.offset(1)
567
567
/// } else {
568
568
/// ptr = &mut P[cur]
@@ -591,7 +591,14 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
591
591
592
592
let one = self . constant_usize ( 1 ) ;
593
593
let ( ptr_next, cur_next) = if ptr_based {
594
- ( Rvalue :: Use ( copy ( & Place :: Local ( cur) ) ) ,
594
+ ( Rvalue :: Ref (
595
+ tcx. types . re_erased ,
596
+ BorrowKind :: Mut { allow_two_phase_borrow : false } ,
597
+ Place :: Projection ( Box :: new ( Projection {
598
+ base : Place :: Local ( cur) ,
599
+ elem : ProjectionElem :: Deref ,
600
+ } ) )
601
+ ) ,
595
602
Rvalue :: BinaryOp ( BinOp :: Offset , copy ( & Place :: Local ( cur) ) , one) )
596
603
} else {
597
604
( Rvalue :: Ref (
@@ -736,7 +743,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
736
743
if ptr_based {
737
744
let tmp_ty = tcx. mk_mut_ptr ( self . place_ty ( self . place ) ) ;
738
745
let tmp = Place :: Local ( self . new_temp ( tmp_ty) ) ;
739
- // tmp = &P;
746
+ // tmp = &mut P;
740
747
// cur = tmp as *mut T;
741
748
// end = Offset(cur, len);
742
749
drop_block_stmts. push ( self . assign ( & tmp, Rvalue :: Ref (
0 commit comments