@@ -3,7 +3,7 @@ use crate::borrow_check::places_conflict;
3
3
use crate :: borrow_check:: AccessDepth ;
4
4
use crate :: dataflow:: indexes:: BorrowIndex ;
5
5
use rustc:: mir:: { BasicBlock , Location , Body , Place , PlaceBase } ;
6
- use rustc:: mir:: { ProjectionElem , BorrowKind } ;
6
+ use rustc:: mir:: BorrowKind ;
7
7
use rustc:: ty:: { self , TyCtxt } ;
8
8
use rustc_data_structures:: graph:: dominators:: Dominators ;
9
9
@@ -133,20 +133,11 @@ pub(super) fn is_active<'tcx>(
133
133
/// Determines if a given borrow is borrowing local data
134
134
/// This is called for all Yield statements on movable generators
135
135
pub ( super ) fn borrow_of_local_data ( place : & Place < ' _ > ) -> bool {
136
- place. iterate ( |place_base, place_projection| {
137
- match place_base {
138
- PlaceBase :: Static ( ..) => return false ,
139
- PlaceBase :: Local ( ..) => { } ,
140
- }
141
-
142
- for proj in place_projection {
143
- // Reborrow of already borrowed data is ignored
144
- // Any errors will be caught on the initial borrow
145
- if proj. elem == ProjectionElem :: Deref {
146
- return false ;
147
- }
148
- }
136
+ match place. base {
137
+ PlaceBase :: Static ( _) => false ,
149
138
150
- true
151
- } )
139
+ // Reborrow of already borrowed data is ignored
140
+ // Any errors will be caught on the initial borrow
141
+ PlaceBase :: Local ( _) => !place. is_indirect ( ) ,
142
+ }
152
143
}
0 commit comments