@@ -111,7 +111,9 @@ impl<'a, 'gcx, 'tcx> ActiveBorrows<'a, 'gcx, 'tcx> {
111
111
#[ allow( dead_code) ]
112
112
#[ derive( Debug ) ]
113
113
pub struct BorrowData < ' tcx > {
114
- pub ( crate ) location : Location ,
114
+ /// Location where the borrow reservation starts.
115
+ /// In many cases, this will be equal to the activation location but not always.
116
+ pub ( crate ) reserve_location : Location ,
115
117
pub ( crate ) kind : mir:: BorrowKind ,
116
118
pub ( crate ) region : Region < ' tcx > ,
117
119
pub ( crate ) borrowed_place : mir:: Place < ' tcx > ,
@@ -209,7 +211,8 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
209
211
if is_unsafe_place ( self . tcx , self . mir , borrowed_place) { return ; }
210
212
211
213
let borrow = BorrowData {
212
- location, kind, region,
214
+ reserve_location : location,
215
+ kind, region,
213
216
borrowed_place : borrowed_place. clone ( ) ,
214
217
assigned_place : assigned_place. clone ( ) ,
215
218
} ;
@@ -245,7 +248,7 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
245
248
let mut found_it = false ;
246
249
for idx in & self . region_map [ region] {
247
250
let bd = & self . idx_vec [ * idx] ;
248
- if bd. location == location &&
251
+ if bd. reserve_location == location &&
249
252
bd. kind == kind &&
250
253
bd. region == region &&
251
254
bd. borrowed_place == * place
@@ -277,7 +280,7 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
277
280
pub fn scope_tree ( & self ) -> & Lrc < region:: ScopeTree > { & self . scope_tree }
278
281
279
282
pub fn location ( & self , idx : BorrowIndex ) -> & Location {
280
- & self . borrows [ idx] . location
283
+ & self . borrows [ idx] . reserve_location
281
284
}
282
285
283
286
/// Add all borrows to the kill set, if those borrows are out of scope at `location`.
0 commit comments