@@ -3,7 +3,7 @@ use crate::borrow_check::places_conflict;
33use crate :: borrow_check:: AccessDepth ;
44use crate :: dataflow:: indexes:: BorrowIndex ;
55use rustc:: mir:: { BasicBlock , Location , Body , Place , PlaceBase } ;
6- use rustc:: mir:: { ProjectionElem , BorrowKind } ;
6+ use rustc:: mir:: BorrowKind ;
77use rustc:: ty:: { self , TyCtxt } ;
88use rustc_data_structures:: graph:: dominators:: Dominators ;
99
@@ -133,20 +133,11 @@ pub(super) fn is_active<'tcx>(
133133/// Determines if a given borrow is borrowing local data
134134/// This is called for all Yield statements on movable generators
135135pub ( 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 ,
149138
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+ }
152143}
0 commit comments