@@ -37,15 +37,15 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
37
37
diag : & mut DiagnosticBuilder < ' _ > ,
38
38
) {
39
39
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 ( ) ;
41
41
for stmt in & self . mir [ location. block ] . statements [ location. statement_index ..] {
42
42
debug ! ( "add_moved_or_invoked_closure_note: stmt={:?} target={:?}" , stmt, target) ;
43
43
if let StatementKind :: Assign ( into, box Rvalue :: Use ( from) ) = & stmt. kind {
44
44
debug ! ( "add_fnonce_closure_note: into={:?} from={:?}" , into, from) ;
45
45
match from {
46
46
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 ( ) ,
49
49
_ => { } ,
50
50
}
51
51
}
@@ -69,8 +69,8 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
69
69
if self . infcx . tcx . parent ( id) == self . infcx . tcx . lang_items ( ) . fn_once_trait ( ) {
70
70
let closure = match args. first ( ) {
71
71
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 ( ) ,
74
74
_ => return ,
75
75
} ;
76
76
0 commit comments