@@ -195,18 +195,14 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
195
195
fn kill_borrows_on_place (
196
196
& self ,
197
197
sets : & mut BlockSets < BorrowIndex > ,
198
- location : Location ,
199
198
place : & Place < ' tcx >
200
199
) {
201
- debug ! ( "kill_borrows_on_place: location={:?} place={:?}" , location , place) ;
200
+ debug ! ( "kill_borrows_on_place: place={:?}" , place) ;
202
201
// Handle the `Place::Local(..)` case first and exit early.
203
202
if let Place :: Local ( local) = place {
204
- if let Some ( borrow_indexes) = self . borrow_set . local_map . get ( & local) {
205
- debug ! (
206
- "kill_borrows_on_place: local={:?} borrow_indexes={:?}" ,
207
- local, borrow_indexes,
208
- ) ;
209
- sets. kill_all ( borrow_indexes) ;
203
+ if let Some ( borrow_indices) = self . borrow_set . local_map . get ( & local) {
204
+ debug ! ( "kill_borrows_on_place: borrow_indices={:?}" , borrow_indices) ;
205
+ sets. kill_all ( borrow_indices) ;
210
206
return ;
211
207
}
212
208
}
@@ -234,16 +230,16 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
234
230
places_conflict:: PlaceConflictBias :: NoOverlap ,
235
231
) {
236
232
debug ! (
237
- "kill_borrows_on_place: (kill) place={:?} borrow_index={:?} borrow_data={:?}" ,
238
- place , borrow_index, borrow_data,
233
+ "kill_borrows_on_place: (kill) borrow_index={:?} borrow_data={:?}" ,
234
+ borrow_index, borrow_data,
239
235
) ;
240
236
sets. kill ( borrow_index) ;
241
237
}
242
238
}
243
239
}
244
240
}
245
241
246
- impl < ' a , ' gcx , ' tcx > BitDenotation for Borrows < ' a , ' gcx , ' tcx > {
242
+ impl < ' a , ' gcx , ' tcx > BitDenotation < ' tcx > for Borrows < ' a , ' gcx , ' tcx > {
247
243
type Idx = BorrowIndex ;
248
244
fn name ( ) -> & ' static str { "borrows" }
249
245
fn bits_per_block ( & self ) -> usize {
@@ -278,12 +274,8 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> {
278
274
mir:: StatementKind :: Assign ( ref lhs, ref rhs) => {
279
275
// Make sure there are no remaining borrows for variables
280
276
// that are assigned over.
281
- self . kill_borrows_on_place ( sets, location , lhs) ;
277
+ self . kill_borrows_on_place ( sets, lhs) ;
282
278
283
- // NOTE: if/when the Assign case is revised to inspect
284
- // the assigned_place here, make sure to also
285
- // re-consider the current implementations of the
286
- // propagate_call_return method.
287
279
if let mir:: Rvalue :: Ref ( _, _, ref place) = * * rhs {
288
280
if place. ignore_borrow (
289
281
self . tcx ,
@@ -317,13 +309,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> {
317
309
mir:: StatementKind :: StorageDead ( local) => {
318
310
// Make sure there are no remaining borrows for locals that
319
311
// are gone out of scope.
320
- self . kill_borrows_on_place ( sets, location , & Place :: Local ( local) ) ;
312
+ self . kill_borrows_on_place ( sets, & Place :: Local ( local) ) ;
321
313
}
322
314
323
315
mir:: StatementKind :: InlineAsm { ref outputs, ref asm, .. } => {
324
316
for ( output, kind) in outputs. iter ( ) . zip ( & asm. outputs ) {
325
317
if !kind. is_indirect && !kind. is_rw {
326
- self . kill_borrows_on_place ( sets, location , output) ;
318
+ self . kill_borrows_on_place ( sets, output) ;
327
319
}
328
320
}
329
321
}
@@ -348,16 +340,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> {
348
340
349
341
fn terminator_effect ( & self , _: & mut BlockSets < BorrowIndex > , _: Location ) { }
350
342
351
- fn propagate_call_return ( & self ,
352
- _in_out : & mut BitSet < BorrowIndex > ,
353
- _call_bb : mir:: BasicBlock ,
354
- _dest_bb : mir:: BasicBlock ,
355
- _dest_place : & mir:: Place ) {
356
- // there are no effects on borrows from method call return...
357
- //
358
- // ... but if overwriting a place can affect flow state, then
359
- // latter is not true; see NOTE on Assign case in
360
- // statement_effect_on_borrows.
343
+ fn propagate_call_return (
344
+ & self ,
345
+ _in_out : & mut BitSet < BorrowIndex > ,
346
+ _call_bb : mir:: BasicBlock ,
347
+ _dest_bb : mir:: BasicBlock ,
348
+ _dest_place : & mir:: Place < ' tcx > ,
349
+ ) {
361
350
}
362
351
}
363
352
0 commit comments