@@ -153,7 +153,10 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
153
153
// like `<T as Foo<'a>>::Item`.
154
154
let generic_ty = generic. to_ty ( tcx) ;
155
155
let c_b = self . param_env . caller_bounds ;
156
- let mut param_bounds = self . collect_outlives_from_predicate_list ( generic_ty, c_b) ;
156
+ let mut param_bounds = self . collect_outlives_from_predicate_list (
157
+ |ty| ty == generic_ty,
158
+ c_b,
159
+ ) ;
157
160
158
161
// Next, collect regions we scraped from the well-formedness
159
162
// constraints in the fn signature. To do that, we walk the list
@@ -241,7 +244,7 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
241
244
let identity_substs = Substs :: identity_for_item ( tcx, assoc_item_def_id) ;
242
245
let identity_proj = tcx. mk_projection ( assoc_item_def_id, identity_substs) ;
243
246
self . collect_outlives_from_predicate_list (
244
- identity_proj,
247
+ |ty| ty == identity_proj,
245
248
traits:: elaborate_predicates ( tcx, trait_predicates. predicates ) ,
246
249
)
247
250
}
@@ -252,20 +255,16 @@ impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> {
252
255
/// when comparing `ty` for equality, so `ty` must be something
253
256
/// that does not involve inference variables and where you
254
257
/// otherwise want a precise match.
255
- fn collect_outlives_from_predicate_list < I , P > (
258
+ fn collect_outlives_from_predicate_list (
256
259
& self ,
257
- ty : Ty < ' tcx > ,
258
- predicates : I ,
259
- ) -> Vec < ty:: Region < ' tcx > >
260
- where
261
- I : IntoIterator < Item = P > ,
262
- P : AsRef < ty:: Predicate < ' tcx > > ,
263
- {
260
+ compare_ty : impl Fn ( Ty < ' tcx > ) -> bool ,
261
+ predicates : impl IntoIterator < Item = impl AsRef < ty:: Predicate < ' tcx > > > ,
262
+ ) -> Vec < ty:: Region < ' tcx > > {
264
263
predicates
265
264
. into_iter ( )
266
265
. filter_map ( |p| p. as_ref ( ) . to_opt_type_outlives ( ) )
267
266
. filter_map ( |p| p. no_late_bound_regions ( ) )
268
- . filter ( |p| p. 0 == ty )
267
+ . filter ( |p| compare_ty ( p. 0 ) )
269
268
. map ( |p| p. 1 )
270
269
. collect ( )
271
270
}
0 commit comments