@@ -12,7 +12,7 @@ use borrow_check::borrow_set::BorrowSet;
12
12
use borrow_check:: location:: { LocationIndex , LocationTable } ;
13
13
use borrow_check:: nll:: facts:: AllFactsExt ;
14
14
use 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 ;
16
16
use borrow_check:: nll:: region_infer:: values:: RegionValueElements ;
17
17
use dataflow:: indexes:: BorrowIndex ;
18
18
use dataflow:: move_paths:: MoveData ;
@@ -22,22 +22,19 @@ use rustc::hir::def_id::DefId;
22
22
use rustc:: infer:: InferCtxt ;
23
23
use rustc:: mir:: { ClosureOutlivesSubject , ClosureRegionRequirements , Mir } ;
24
24
use rustc:: ty:: { self , RegionKind , RegionVid } ;
25
- use rustc:: util:: nodemap:: FxHashMap ;
26
25
use rustc_errors:: Diagnostic ;
27
- use std:: collections:: BTreeSet ;
28
26
use std:: fmt:: Debug ;
29
27
use std:: env;
30
28
use std:: io;
31
29
use std:: path:: PathBuf ;
32
30
use std:: rc:: Rc ;
33
31
use std:: str:: FromStr ;
34
32
use transform:: MirSource ;
35
- use util:: liveness:: { LivenessResults , LiveVarSet } ;
36
33
37
34
use self :: mir_util:: PassWhere ;
38
35
use polonius_engine:: { Algorithm , Output } ;
39
36
use util as mir_util;
40
- use util:: pretty:: { self , ALIGN } ;
37
+ use util:: pretty;
41
38
42
39
mod constraint_generation;
43
40
pub mod explain_borrow;
@@ -111,8 +108,6 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
111
108
let MirTypeckResults {
112
109
constraints,
113
110
universal_region_relations,
114
- liveness,
115
- liveness_map,
116
111
} = type_check:: type_check (
117
112
infcx,
118
113
param_env,
@@ -205,8 +200,6 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
205
200
// write unit-tests, as well as helping with debugging.
206
201
dump_mir_results (
207
202
infcx,
208
- & liveness,
209
- & liveness_map,
210
203
MirSource :: item ( def_id) ,
211
204
& mir,
212
205
& regioncx,
@@ -222,8 +215,6 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
222
215
223
216
fn dump_mir_results < ' a , ' gcx , ' tcx > (
224
217
infcx : & InferCtxt < ' a , ' gcx , ' tcx > ,
225
- liveness : & LivenessResults < LocalWithRegion > ,
226
- liveness_map : & NllLivenessMap ,
227
218
source : MirSource ,
228
219
mir : & Mir < ' tcx > ,
229
220
regioncx : & RegionInferenceContext ,
@@ -233,34 +224,6 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
233
224
return ;
234
225
}
235
226
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
-
264
227
mir_util:: dump_mir (
265
228
infcx. tcx ,
266
229
None ,
@@ -283,26 +246,10 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
283
246
}
284
247
}
285
248
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 ( _) => {
299
250
}
300
251
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 ( _) => {
306
253
}
307
254
308
255
PassWhere :: BeforeBlock ( _) | PassWhere :: AfterLocation ( _) | PassWhere :: AfterCFG => { }
@@ -420,33 +367,3 @@ impl ToRegionVid for RegionVid {
420
367
self
421
368
}
422
369
}
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