@@ -195,18 +195,14 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
195195 fn kill_borrows_on_place (
196196 & self ,
197197 sets : & mut BlockSets < BorrowIndex > ,
198- location : Location ,
199198 place : & Place < ' tcx >
200199 ) {
201- debug ! ( "kill_borrows_on_place: location={:?} place={:?}" , location , place) ;
200+ debug ! ( "kill_borrows_on_place: place={:?}" , place) ;
202201 // Handle the `Place::Local(..)` case first and exit early.
203202 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) ;
210206 return ;
211207 }
212208 }
@@ -234,16 +230,16 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
234230 places_conflict:: PlaceConflictBias :: NoOverlap ,
235231 ) {
236232 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,
239235 ) ;
240236 sets. kill ( borrow_index) ;
241237 }
242238 }
243239 }
244240}
245241
246- impl < ' a , ' gcx , ' tcx > BitDenotation for Borrows < ' a , ' gcx , ' tcx > {
242+ impl < ' a , ' gcx , ' tcx > BitDenotation < ' tcx > for Borrows < ' a , ' gcx , ' tcx > {
247243 type Idx = BorrowIndex ;
248244 fn name ( ) -> & ' static str { "borrows" }
249245 fn bits_per_block ( & self ) -> usize {
@@ -278,12 +274,8 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> {
278274 mir:: StatementKind :: Assign ( ref lhs, ref rhs) => {
279275 // Make sure there are no remaining borrows for variables
280276 // that are assigned over.
281- self . kill_borrows_on_place ( sets, location , lhs) ;
277+ self . kill_borrows_on_place ( sets, lhs) ;
282278
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.
287279 if let mir:: Rvalue :: Ref ( _, _, ref place) = * * rhs {
288280 if place. ignore_borrow (
289281 self . tcx ,
@@ -317,13 +309,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> {
317309 mir:: StatementKind :: StorageDead ( local) => {
318310 // Make sure there are no remaining borrows for locals that
319311 // 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) ) ;
321313 }
322314
323315 mir:: StatementKind :: InlineAsm { ref outputs, ref asm, .. } => {
324316 for ( output, kind) in outputs. iter ( ) . zip ( & asm. outputs ) {
325317 if !kind. is_indirect && !kind. is_rw {
326- self . kill_borrows_on_place ( sets, location , output) ;
318+ self . kill_borrows_on_place ( sets, output) ;
327319 }
328320 }
329321 }
@@ -348,16 +340,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation for Borrows<'a, 'gcx, 'tcx> {
348340
349341 fn terminator_effect ( & self , _: & mut BlockSets < BorrowIndex > , _: Location ) { }
350342
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+ ) {
361350 }
362351}
363352
0 commit comments