@@ -20,14 +20,13 @@ use self::Classification::*;
2020
2121use super :: { RegionVariableOrigin , SubregionOrigin , TypeTrace , MiscVariable } ;
2222
23+ use rustc_data_structures:: graph:: { self , Direction , NodeIndex } ;
2324use middle:: region;
2425use middle:: ty:: { self , Ty } ;
2526use middle:: ty:: { BoundRegion , FreeRegion , Region , RegionVid } ;
2627use middle:: ty:: { ReEmpty , ReStatic , ReInfer , ReFree , ReEarlyBound } ;
2728use middle:: ty:: { ReLateBound , ReScope , ReVar , ReSkolemized , BrFresh } ;
2829use middle:: ty_relate:: RelateResult ;
29- use middle:: graph;
30- use middle:: graph:: { Direction , NodeIndex } ;
3130use util:: common:: indenter;
3231use util:: nodemap:: { FnvHashMap , FnvHashSet } ;
3332use util:: ppaux:: { Repr , UserString } ;
@@ -1325,10 +1324,8 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
13251324 let num_vars = self . num_vars ( ) ;
13261325
13271326 let constraints = self . constraints . borrow ( ) ;
1328- let num_edges = constraints. len ( ) ;
13291327
1330- let mut graph = graph:: Graph :: with_capacity ( num_vars as usize + 1 ,
1331- num_edges) ;
1328+ let mut graph = graph:: Graph :: new ( ) ;
13321329
13331330 for _ in 0 ..num_vars {
13341331 graph. add_node ( ( ) ) ;
@@ -1370,10 +1367,10 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
13701367 // not contained by an upper-bound.
13711368 let ( mut lower_bounds, lower_dup) =
13721369 self . collect_concrete_regions ( graph, var_data, node_idx,
1373- graph:: Incoming , dup_vec) ;
1370+ graph:: INCOMING , dup_vec) ;
13741371 let ( mut upper_bounds, upper_dup) =
13751372 self . collect_concrete_regions ( graph, var_data, node_idx,
1376- graph:: Outgoing , dup_vec) ;
1373+ graph:: OUTGOING , dup_vec) ;
13771374
13781375 if lower_dup || upper_dup {
13791376 return ;
@@ -1433,7 +1430,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
14331430 // that have no intersection.
14341431 let ( upper_bounds, dup_found) =
14351432 self . collect_concrete_regions ( graph, var_data, node_idx,
1436- graph:: Outgoing , dup_vec) ;
1433+ graph:: OUTGOING , dup_vec) ;
14371434
14381435 if dup_found {
14391436 return ;
@@ -1508,8 +1505,8 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
15081505 // figure out the direction from which this node takes its
15091506 // values, and search for concrete regions etc in that direction
15101507 let dir = match classification {
1511- Expanding => graph:: Incoming ,
1512- Contracting => graph:: Outgoing ,
1508+ Expanding => graph:: INCOMING ,
1509+ Contracting => graph:: OUTGOING ,
15131510 } ;
15141511
15151512 process_edges ( self , & mut state, graph, node_idx, dir) ;
@@ -1519,14 +1516,14 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
15191516 return ( result, dup_found) ;
15201517
15211518 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 ) {
15261523 debug ! ( "process_edges(source_vid={:?}, dir={:?})" , source_vid, dir) ;
15271524
15281525 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) {
15301527 match edge. data {
15311528 ConstrainVarSubVar ( from_vid, to_vid) => {
15321529 let opp_vid =
@@ -1544,8 +1541,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
15441541 } ) ;
15451542 }
15461543 }
1547- true
1548- } ) ;
1544+ }
15491545 }
15501546 }
15511547
0 commit comments