@@ -63,12 +63,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
63
63
// Regions that have been visited.
64
64
let mut visited = FxHashSet ( ) ;
65
65
// Ends of paths.
66
- let mut end_regions: Vec < RegionVid > = Vec :: new ( ) ;
66
+ let mut end_regions = FxHashSet ( ) ;
67
67
68
68
// When we've still got points to visit...
69
69
while let Some ( current) = next. pop ( ) {
70
70
// ...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) ;
72
75
73
76
// ...find the edges containing it...
74
77
let mut upcoming = Vec :: new ( ) ;
@@ -93,16 +96,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
93
96
if upcoming. is_empty ( ) {
94
97
// If we didn't find any edges then this is the end of a path...
95
98
debug ! ( "find_constraint_paths_from_region: new end region current={:?}" , current) ;
96
- end_regions. push ( current) ;
99
+ end_regions. insert ( current) ;
97
100
} 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.
99
102
debug ! ( "find_constraint_paths_from_region: extend next upcoming={:?}" , upcoming) ;
100
103
next. extend ( upcoming) ;
101
104
}
102
105
103
- // ...and don't visit it again.
104
- visited. insert ( current. clone ( ) ) ;
105
- debug ! ( "find_constraint_paths_from_region: next={:?} visited={:?}" , next, visited) ;
106
106
}
107
107
108
108
// Now we've visited each point, compute the final paths.
0 commit comments