@@ -161,9 +161,28 @@ fn compute_components<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
161
161
compute_components ( infcx, ty, out) ;
162
162
}
163
163
}
164
- _ => {
165
- // for all other types, just constrain the regions and
166
- // keep walking to find any other types.
164
+
165
+ // Most types do not introduce any region binders, nor
166
+ // involve any other subtle cases, and so the WF relation
167
+ // simply constraints any regions referenced directly by
168
+ // the type and then visits the types that are lexically
169
+ // contained within. (The comments refer to relevant rules
170
+ // from RFC1214.)
171
+ ty:: TyBool ( ..) | // OutlivesScalar
172
+ ty:: TyChar ( ..) | // OutlivesScalar
173
+ ty:: TyInt ( ..) | // OutlivesScalar
174
+ ty:: TyUint ( ..) | // OutlivesScalar
175
+ ty:: TyFloat ( ..) | // OutlivesScalar
176
+ ty:: TyEnum ( ..) | // OutlivesNominalType
177
+ ty:: TyStruct ( ..) | // OutlivesNominalType
178
+ ty:: TyBox ( ..) | // OutlivesNominalType (ish)
179
+ ty:: TyStr ( ..) | // OutlivesScalar (ish)
180
+ ty:: TyArray ( ..) | // ...
181
+ ty:: TySlice ( ..) | // ...
182
+ ty:: TyRawPtr ( ..) | // ...
183
+ ty:: TyRef ( ..) | // OutlivesReference
184
+ ty:: TyTuple ( ..) | // ...
185
+ ty:: TyError ( ..) => {
167
186
push_region_constraints ( out, ty. regions ( ) ) ;
168
187
}
169
188
}
@@ -188,4 +207,3 @@ fn push_region_constraints<'tcx>(out: &mut Vec<Component<'tcx>>, regions: Vec<ty
188
207
}
189
208
}
190
209
}
191
-
0 commit comments