@@ -20,14 +20,13 @@ use self::Classification::*;
20
20
21
21
use super :: { RegionVariableOrigin , SubregionOrigin , TypeTrace , MiscVariable } ;
22
22
23
+ use rustc_data_structures:: graph:: { self , Direction , NodeIndex } ;
23
24
use middle:: region;
24
25
use middle:: ty:: { self , Ty } ;
25
26
use middle:: ty:: { BoundRegion , FreeRegion , Region , RegionVid } ;
26
27
use middle:: ty:: { ReEmpty , ReStatic , ReInfer , ReFree , ReEarlyBound } ;
27
28
use middle:: ty:: { ReLateBound , ReScope , ReVar , ReSkolemized , BrFresh } ;
28
29
use middle:: ty_relate:: RelateResult ;
29
- use middle:: graph;
30
- use middle:: graph:: { Direction , NodeIndex } ;
31
30
use util:: common:: indenter;
32
31
use util:: nodemap:: { FnvHashMap , FnvHashSet } ;
33
32
use util:: ppaux:: { Repr , UserString } ;
@@ -1325,10 +1324,8 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
1325
1324
let num_vars = self . num_vars ( ) ;
1326
1325
1327
1326
let constraints = self . constraints . borrow ( ) ;
1328
- let num_edges = constraints. len ( ) ;
1329
1327
1330
- let mut graph = graph:: Graph :: with_capacity ( num_vars as usize + 1 ,
1331
- num_edges) ;
1328
+ let mut graph = graph:: Graph :: new ( ) ;
1332
1329
1333
1330
for _ in 0 ..num_vars {
1334
1331
graph. add_node ( ( ) ) ;
@@ -1370,10 +1367,10 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
1370
1367
// not contained by an upper-bound.
1371
1368
let ( mut lower_bounds, lower_dup) =
1372
1369
self . collect_concrete_regions ( graph, var_data, node_idx,
1373
- graph:: Incoming , dup_vec) ;
1370
+ graph:: INCOMING , dup_vec) ;
1374
1371
let ( mut upper_bounds, upper_dup) =
1375
1372
self . collect_concrete_regions ( graph, var_data, node_idx,
1376
- graph:: Outgoing , dup_vec) ;
1373
+ graph:: OUTGOING , dup_vec) ;
1377
1374
1378
1375
if lower_dup || upper_dup {
1379
1376
return ;
@@ -1433,7 +1430,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
1433
1430
// that have no intersection.
1434
1431
let ( upper_bounds, dup_found) =
1435
1432
self . collect_concrete_regions ( graph, var_data, node_idx,
1436
- graph:: Outgoing , dup_vec) ;
1433
+ graph:: OUTGOING , dup_vec) ;
1437
1434
1438
1435
if dup_found {
1439
1436
return ;
@@ -1508,8 +1505,8 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
1508
1505
// figure out the direction from which this node takes its
1509
1506
// values, and search for concrete regions etc in that direction
1510
1507
let dir = match classification {
1511
- Expanding => graph:: Incoming ,
1512
- Contracting => graph:: Outgoing ,
1508
+ Expanding => graph:: INCOMING ,
1509
+ Contracting => graph:: OUTGOING ,
1513
1510
} ;
1514
1511
1515
1512
process_edges ( self , & mut state, graph, node_idx, dir) ;
@@ -1519,14 +1516,14 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
1519
1516
return ( result, dup_found) ;
1520
1517
1521
1518
fn process_edges < ' a , ' tcx > ( this : & RegionVarBindings < ' a , ' tcx > ,
1522
- state : & mut WalkState < ' tcx > ,
1523
- graph : & RegionGraph ,
1524
- source_vid : RegionVid ,
1525
- dir : Direction ) {
1519
+ state : & mut WalkState < ' tcx > ,
1520
+ graph : & RegionGraph ,
1521
+ source_vid : RegionVid ,
1522
+ dir : Direction ) {
1526
1523
debug ! ( "process_edges(source_vid={:?}, dir={:?})" , source_vid, dir) ;
1527
1524
1528
1525
let source_node_index = NodeIndex ( source_vid. index as usize ) ;
1529
- graph. each_adjacent_edge ( source_node_index, dir, |_ , edge| {
1526
+ for ( _ , edge ) in graph. adjacent_edges ( source_node_index, dir) {
1530
1527
match edge. data {
1531
1528
ConstrainVarSubVar ( from_vid, to_vid) => {
1532
1529
let opp_vid =
@@ -1544,8 +1541,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
1544
1541
} ) ;
1545
1542
}
1546
1543
}
1547
- true
1548
- } ) ;
1544
+ }
1549
1545
}
1550
1546
}
1551
1547
0 commit comments