@@ -37,15 +37,15 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
3737 diag : & mut DiagnosticBuilder < ' _ > ,
3838 ) {
3939 debug ! ( "add_moved_or_invoked_closure_note: location={:?} place={:?}" , location, place) ;
40- let mut target = place. local ( ) ;
40+ let mut target = place. local_or_deref_local ( ) ;
4141 for stmt in & self . mir [ location. block ] . statements [ location. statement_index ..] {
4242 debug ! ( "add_moved_or_invoked_closure_note: stmt={:?} target={:?}" , stmt, target) ;
4343 if let StatementKind :: Assign ( into, box Rvalue :: Use ( from) ) = & stmt. kind {
4444 debug ! ( "add_fnonce_closure_note: into={:?} from={:?}" , into, from) ;
4545 match from {
4646 Operand :: Copy ( ref place) |
47- Operand :: Move ( ref place) if target == place. local ( ) =>
48- target = into. local ( ) ,
47+ Operand :: Move ( ref place) if target == place. local_or_deref_local ( ) =>
48+ target = into. local_or_deref_local ( ) ,
4949 _ => { } ,
5050 }
5151 }
@@ -69,8 +69,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
6969 if self . infcx . tcx . parent ( id) == self . infcx . tcx . lang_items ( ) . fn_once_trait ( ) {
7070 let closure = match args. first ( ) {
7171 Some ( Operand :: Copy ( ref place) ) |
72- Some ( Operand :: Move ( ref place) ) if target == place. local ( ) =>
73- place. local ( ) . unwrap ( ) ,
72+ Some ( Operand :: Move ( ref place) ) if target == place. local_or_deref_local ( ) =>
73+ place. local_or_deref_local ( ) . unwrap ( ) ,
7474 _ => return ,
7575 } ;
7676
0 commit comments