@@ -63,12 +63,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
6363 // Regions that have been visited.
6464 let mut visited = FxHashSet ( ) ;
6565 // Ends of paths.
66- let mut end_regions: Vec < RegionVid > = Vec :: new ( ) ;
66+ let mut end_regions = FxHashSet ( ) ;
6767
6868 // When we've still got points to visit...
6969 while let Some ( current) = next. pop ( ) {
7070 // ...take the next point...
71- debug ! ( "find_constraint_paths_from_region: current={:?} next={:?}" , current, next) ;
71+ debug ! ( "find_constraint_paths_from_region: current={:?} visited={:?} next={:?}" ,
72+ current, visited, next) ;
73+ // ...but make sure not to visit this point again...
74+ visited. insert ( current) ;
7275
7376 // ...find the edges containing it...
7477 let mut upcoming = Vec :: new ( ) ;
@@ -93,16 +96,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
9396 if upcoming. is_empty ( ) {
9497 // If we didn't find any edges then this is the end of a path...
9598 debug ! ( "find_constraint_paths_from_region: new end region current={:?}" , current) ;
96- end_regions. push ( current) ;
99+ end_regions. insert ( current) ;
97100 } else {
98- // ...but, if we did find edges, then add these to the regions yet to visit...
101+ // ...but, if we did find edges, then add these to the regions yet to visit.
99102 debug ! ( "find_constraint_paths_from_region: extend next upcoming={:?}" , upcoming) ;
100103 next. extend ( upcoming) ;
101104 }
102105
103- // ...and don't visit it again.
104- visited. insert ( current. clone ( ) ) ;
105- debug ! ( "find_constraint_paths_from_region: next={:?} visited={:?}" , next, visited) ;
106106 }
107107
108108 // Now we've visited each point, compute the final paths.
0 commit comments