@@ -12,7 +12,7 @@ use borrow_check::borrow_set::BorrowSet;
1212use borrow_check:: location:: { LocationIndex , LocationTable } ;
1313use borrow_check:: nll:: facts:: AllFactsExt ;
1414use borrow_check:: nll:: type_check:: { MirTypeckResults , MirTypeckRegionConstraints } ;
15- use borrow_check:: nll:: type_check:: liveness:: liveness_map:: { NllLivenessMap , LocalWithRegion } ;
15+ use borrow_check:: nll:: type_check:: liveness:: liveness_map:: NllLivenessMap ;
1616use borrow_check:: nll:: region_infer:: values:: RegionValueElements ;
1717use dataflow:: indexes:: BorrowIndex ;
1818use dataflow:: move_paths:: MoveData ;
@@ -22,22 +22,19 @@ use rustc::hir::def_id::DefId;
2222use rustc:: infer:: InferCtxt ;
2323use rustc:: mir:: { ClosureOutlivesSubject , ClosureRegionRequirements , Mir } ;
2424use rustc:: ty:: { self , RegionKind , RegionVid } ;
25- use rustc:: util:: nodemap:: FxHashMap ;
2625use rustc_errors:: Diagnostic ;
27- use std:: collections:: BTreeSet ;
2826use std:: fmt:: Debug ;
2927use std:: env;
3028use std:: io;
3129use std:: path:: PathBuf ;
3230use std:: rc:: Rc ;
3331use std:: str:: FromStr ;
3432use transform:: MirSource ;
35- use util:: liveness:: { LivenessResults , LiveVarSet } ;
3633
3734use self :: mir_util:: PassWhere ;
3835use polonius_engine:: { Algorithm , Output } ;
3936use util as mir_util;
40- use util:: pretty:: { self , ALIGN } ;
37+ use util:: pretty;
4138
4239mod constraint_generation;
4340pub mod explain_borrow;
@@ -111,8 +108,6 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
111108 let MirTypeckResults {
112109 constraints,
113110 universal_region_relations,
114- liveness,
115- liveness_map,
116111 } = type_check:: type_check (
117112 infcx,
118113 param_env,
@@ -205,8 +200,6 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
205200 // write unit-tests, as well as helping with debugging.
206201 dump_mir_results (
207202 infcx,
208- & liveness,
209- & liveness_map,
210203 MirSource :: item ( def_id) ,
211204 & mir,
212205 & regioncx,
@@ -222,8 +215,6 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
222215
223216fn dump_mir_results < ' a , ' gcx , ' tcx > (
224217 infcx : & InferCtxt < ' a , ' gcx , ' tcx > ,
225- liveness : & LivenessResults < LocalWithRegion > ,
226- liveness_map : & NllLivenessMap ,
227218 source : MirSource ,
228219 mir : & Mir < ' tcx > ,
229220 regioncx : & RegionInferenceContext ,
@@ -233,34 +224,6 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
233224 return ;
234225 }
235226
236- let regular_liveness_per_location: FxHashMap < _ , _ > = mir
237- . basic_blocks ( )
238- . indices ( )
239- . flat_map ( |bb| {
240- let mut results = vec ! [ ] ;
241- liveness
242- . regular
243- . simulate_block ( & mir, bb, liveness_map, |location, local_set| {
244- results. push ( ( location, local_set. clone ( ) ) ) ;
245- } ) ;
246- results
247- } )
248- . collect ( ) ;
249-
250- let drop_liveness_per_location: FxHashMap < _ , _ > = mir
251- . basic_blocks ( )
252- . indices ( )
253- . flat_map ( |bb| {
254- let mut results = vec ! [ ] ;
255- liveness
256- . drop
257- . simulate_block ( & mir, bb, liveness_map, |location, local_set| {
258- results. push ( ( location, local_set. clone ( ) ) ) ;
259- } ) ;
260- results
261- } )
262- . collect ( ) ;
263-
264227 mir_util:: dump_mir (
265228 infcx. tcx ,
266229 None ,
@@ -283,26 +246,10 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
283246 }
284247 }
285248
286- PassWhere :: BeforeLocation ( location) => {
287- let s = live_variable_set (
288- & regular_liveness_per_location[ & location] ,
289- & drop_liveness_per_location[ & location] ,
290- ) ;
291- writeln ! (
292- out,
293- "{:ALIGN$} | Live variables on entry to {:?}: {}" ,
294- "" ,
295- location,
296- s,
297- ALIGN = ALIGN
298- ) ?;
249+ PassWhere :: BeforeLocation ( _) => {
299250 }
300251
301- // After each basic block, dump out the values
302- // that are live on exit from the basic block.
303- PassWhere :: AfterTerminator ( bb) => {
304- let s = live_variable_set ( & liveness. regular . outs [ bb] , & liveness. drop . outs [ bb] ) ;
305- writeln ! ( out, " | Live variables on exit from {:?}: {}" , bb, s) ?;
252+ PassWhere :: AfterTerminator ( _) => {
306253 }
307254
308255 PassWhere :: BeforeBlock ( _) | PassWhere :: AfterLocation ( _) | PassWhere :: AfterCFG => { }
@@ -420,33 +367,3 @@ impl ToRegionVid for RegionVid {
420367 self
421368 }
422369}
423-
424- fn live_variable_set (
425- regular : & LiveVarSet < LocalWithRegion > ,
426- drops : & LiveVarSet < LocalWithRegion >
427- ) -> String {
428- // sort and deduplicate:
429- let all_locals: BTreeSet < _ > = regular. iter ( ) . chain ( drops. iter ( ) ) . collect ( ) ;
430-
431- // construct a string with each local, including `(drop)` if it is
432- // only dropped, versus a regular use.
433- let mut string = String :: new ( ) ;
434- for local in all_locals {
435- string. push_str ( & format ! ( "{:?}" , local) ) ;
436-
437- if !regular. contains ( & local) {
438- assert ! ( drops. contains( & local) ) ;
439- string. push_str ( " (drop)" ) ;
440- }
441-
442- string. push_str ( ", " ) ;
443- }
444-
445- let len = if string. is_empty ( ) {
446- 0
447- } else {
448- string. len ( ) - 2
449- } ;
450-
451- format ! ( "[{}]" , & string[ ..len] )
452- }
0 commit comments