@@ -13,7 +13,7 @@ use crate::{
13
13
/// The construct graph organizes the constraints by their end-points.
14
14
/// It can be used to view a `R1: R2` constraint as either an edge `R1
15
15
/// -> R2` or `R2 -> R1` depending on the direction type `D`.
16
- pub ( crate ) struct ConstraintGraph < D : ConstraintGraphDirecton > {
16
+ pub ( crate ) struct ConstraintGraph < D : ConstraintGraphDirection > {
17
17
_direction : D ,
18
18
first_constraints : IndexVec < RegionVid , Option < OutlivesConstraintIndex > > ,
19
19
next_constraints : IndexVec < OutlivesConstraintIndex , Option < OutlivesConstraintIndex > > ,
@@ -25,7 +25,7 @@ pub(crate) type ReverseConstraintGraph = ConstraintGraph<Reverse>;
25
25
26
26
/// Marker trait that controls whether a `R1: R2` constraint
27
27
/// represents an edge `R1 -> R2` or `R2 -> R1`.
28
- pub ( crate ) trait ConstraintGraphDirecton : Copy + ' static {
28
+ pub ( crate ) trait ConstraintGraphDirection : Copy + ' static {
29
29
fn start_region ( c : & OutlivesConstraint < ' _ > ) -> RegionVid ;
30
30
fn end_region ( c : & OutlivesConstraint < ' _ > ) -> RegionVid ;
31
31
fn is_normal ( ) -> bool ;
@@ -38,7 +38,7 @@ pub(crate) trait ConstraintGraphDirecton: Copy + 'static {
38
38
#[ derive( Copy , Clone , Debug ) ]
39
39
pub ( crate ) struct Normal ;
40
40
41
- impl ConstraintGraphDirecton for Normal {
41
+ impl ConstraintGraphDirection for Normal {
42
42
fn start_region ( c : & OutlivesConstraint < ' _ > ) -> RegionVid {
43
43
c. sup
44
44
}
@@ -59,7 +59,7 @@ impl ConstraintGraphDirecton for Normal {
59
59
#[ derive( Copy , Clone , Debug ) ]
60
60
pub ( crate ) struct Reverse ;
61
61
62
- impl ConstraintGraphDirecton for Reverse {
62
+ impl ConstraintGraphDirection for Reverse {
63
63
fn start_region ( c : & OutlivesConstraint < ' _ > ) -> RegionVid {
64
64
c. sub
65
65
}
@@ -73,7 +73,7 @@ impl ConstraintGraphDirecton for Reverse {
73
73
}
74
74
}
75
75
76
- impl < D : ConstraintGraphDirecton > ConstraintGraph < D > {
76
+ impl < D : ConstraintGraphDirection > ConstraintGraph < D > {
77
77
/// Creates a "dependency graph" where each region constraint `R1:
78
78
/// R2` is treated as an edge `R1 -> R2`. We use this graph to
79
79
/// construct SCCs for region inference but also for error
@@ -133,15 +133,15 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
133
133
}
134
134
}
135
135
136
- pub ( crate ) struct Edges < ' s , ' tcx , D : ConstraintGraphDirecton > {
136
+ pub ( crate ) struct Edges < ' s , ' tcx , D : ConstraintGraphDirection > {
137
137
graph : & ' s ConstraintGraph < D > ,
138
138
constraints : & ' s OutlivesConstraintSet < ' tcx > ,
139
139
pointer : Option < OutlivesConstraintIndex > ,
140
140
next_static_idx : Option < usize > ,
141
141
static_region : RegionVid ,
142
142
}
143
143
144
- impl < ' s , ' tcx , D : ConstraintGraphDirecton > Iterator for Edges < ' s , ' tcx , D > {
144
+ impl < ' s , ' tcx , D : ConstraintGraphDirection > Iterator for Edges < ' s , ' tcx , D > {
145
145
type Item = OutlivesConstraint < ' tcx > ;
146
146
147
147
fn next ( & mut self ) -> Option < Self :: Item > {
@@ -174,13 +174,13 @@ impl<'s, 'tcx, D: ConstraintGraphDirecton> Iterator for Edges<'s, 'tcx, D> {
174
174
/// This struct brings together a constraint set and a (normal, not
175
175
/// reverse) constraint graph. It implements the graph traits and is
176
176
/// usd for doing the SCC computation.
177
- pub ( crate ) struct RegionGraph < ' s , ' tcx , D : ConstraintGraphDirecton > {
177
+ pub ( crate ) struct RegionGraph < ' s , ' tcx , D : ConstraintGraphDirection > {
178
178
set : & ' s OutlivesConstraintSet < ' tcx > ,
179
179
constraint_graph : & ' s ConstraintGraph < D > ,
180
180
static_region : RegionVid ,
181
181
}
182
182
183
- impl < ' s , ' tcx , D : ConstraintGraphDirecton > RegionGraph < ' s , ' tcx , D > {
183
+ impl < ' s , ' tcx , D : ConstraintGraphDirection > RegionGraph < ' s , ' tcx , D > {
184
184
/// Creates a "dependency graph" where each region constraint `R1:
185
185
/// R2` is treated as an edge `R1 -> R2`. We use this graph to
186
186
/// construct SCCs for region inference but also for error
@@ -202,35 +202,37 @@ impl<'s, 'tcx, D: ConstraintGraphDirecton> RegionGraph<'s, 'tcx, D> {
202
202
}
203
203
}
204
204
205
- pub ( crate ) struct Successors < ' s , ' tcx , D : ConstraintGraphDirecton > {
205
+ pub ( crate ) struct Successors < ' s , ' tcx , D : ConstraintGraphDirection > {
206
206
edges : Edges < ' s , ' tcx , D > ,
207
207
}
208
208
209
- impl < ' s , ' tcx , D : ConstraintGraphDirecton > Iterator for Successors < ' s , ' tcx , D > {
209
+ impl < ' s , ' tcx , D : ConstraintGraphDirection > Iterator for Successors < ' s , ' tcx , D > {
210
210
type Item = RegionVid ;
211
211
212
212
fn next ( & mut self ) -> Option < Self :: Item > {
213
213
self . edges . next ( ) . map ( |c| D :: end_region ( & c) )
214
214
}
215
215
}
216
216
217
- impl < ' s , ' tcx , D : ConstraintGraphDirecton > graph:: DirectedGraph for RegionGraph < ' s , ' tcx , D > {
217
+ impl < ' s , ' tcx , D : ConstraintGraphDirection > graph:: DirectedGraph for RegionGraph < ' s , ' tcx , D > {
218
218
type Node = RegionVid ;
219
219
}
220
220
221
- impl < ' s , ' tcx , D : ConstraintGraphDirecton > graph:: WithNumNodes for RegionGraph < ' s , ' tcx , D > {
221
+ impl < ' s , ' tcx , D : ConstraintGraphDirection > graph:: WithNumNodes for RegionGraph < ' s , ' tcx , D > {
222
222
fn num_nodes ( & self ) -> usize {
223
223
self . constraint_graph . first_constraints . len ( )
224
224
}
225
225
}
226
226
227
- impl < ' s , ' tcx , D : ConstraintGraphDirecton > graph:: WithSuccessors for RegionGraph < ' s , ' tcx , D > {
227
+ impl < ' s , ' tcx , D : ConstraintGraphDirection > graph:: WithSuccessors for RegionGraph < ' s , ' tcx , D > {
228
228
fn successors ( & self , node : Self :: Node ) -> <Self as graph:: GraphSuccessors < ' _ > >:: Iter {
229
229
self . outgoing_regions ( node)
230
230
}
231
231
}
232
232
233
- impl < ' s , ' tcx , D : ConstraintGraphDirecton > graph:: GraphSuccessors < ' _ > for RegionGraph < ' s , ' tcx , D > {
233
+ impl < ' s , ' tcx , D : ConstraintGraphDirection > graph:: GraphSuccessors < ' _ >
234
+ for RegionGraph < ' s , ' tcx , D >
235
+ {
234
236
type Item = RegionVid ;
235
237
type Iter = Successors < ' s , ' tcx , D > ;
236
238
}
0 commit comments