@@ -45,6 +45,7 @@ pub trait Delegate<'tcx> {
4545 place_with_id : & PlaceWithHirId < ' tcx > ,
4646 diag_expr_id : hir:: HirId ,
4747 bk : ty:: BorrowKind ,
48+ is_autoref : bool ,
4849 ) ;
4950
5051 /// The path at `assignee_place` is being assigned to.
@@ -175,7 +176,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
175176 debug ! ( "borrow_expr(expr={:?}, bk={:?})" , expr, bk) ;
176177
177178 let place_with_id = return_if_err ! ( self . mc. cat_expr( expr) ) ;
178- self . delegate . borrow ( & place_with_id, place_with_id. hir_id , bk) ;
179+ self . delegate . borrow ( & place_with_id, place_with_id. hir_id , bk, false ) ;
179180
180181 self . walk_expr ( expr)
181182 }
@@ -558,7 +559,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
558559 // this is an autoref of `x`.
559560 adjustment:: Adjust :: Deref ( Some ( ref deref) ) => {
560561 let bk = ty:: BorrowKind :: from_mutbl ( deref. mutbl ) ;
561- self . delegate . borrow ( & place_with_id, place_with_id. hir_id , bk) ;
562+ self . delegate . borrow ( & place_with_id, place_with_id. hir_id , bk, true ) ;
562563 }
563564
564565 adjustment:: Adjust :: Borrow ( ref autoref) => {
@@ -590,13 +591,14 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
590591 base_place,
591592 base_place. hir_id ,
592593 ty:: BorrowKind :: from_mutbl ( m. into ( ) ) ,
594+ true ,
593595 ) ;
594596 }
595597
596598 adjustment:: AutoBorrow :: RawPtr ( m) => {
597599 debug ! ( "walk_autoref: expr.hir_id={} base_place={:?}" , expr. hir_id, base_place) ;
598600
599- self . delegate . borrow ( base_place, base_place. hir_id , ty:: BorrowKind :: from_mutbl ( m) ) ;
601+ self . delegate . borrow ( base_place, base_place. hir_id , ty:: BorrowKind :: from_mutbl ( m) , true ) ;
600602 }
601603 }
602604 }
@@ -669,7 +671,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
669671 match bm {
670672 ty:: BindByReference ( m) => {
671673 let bk = ty:: BorrowKind :: from_mutbl( m) ;
672- delegate. borrow( place, discr_place. hir_id, bk) ;
674+ delegate. borrow( place, discr_place. hir_id, bk, false ) ;
673675 }
674676 ty:: BindByValue ( ..) => {
675677 debug!( "walk_pat binding consuming pat" ) ;
@@ -799,6 +801,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
799801 & place_with_id,
800802 place_with_id. hir_id ,
801803 upvar_borrow,
804+ false ,
802805 ) ;
803806 }
804807 }
@@ -837,7 +840,7 @@ fn delegate_consume<'a, 'tcx>(
837840 match mode {
838841 ConsumeMode :: Move => delegate. consume ( place_with_id, diag_expr_id) ,
839842 ConsumeMode :: Copy => {
840- delegate. borrow ( place_with_id, diag_expr_id, ty:: BorrowKind :: ImmBorrow )
843+ delegate. borrow ( place_with_id, diag_expr_id, ty:: BorrowKind :: ImmBorrow , false )
841844 }
842845 }
843846}
0 commit comments