@@ -275,19 +275,34 @@ pub enum InlineBound {
275
275
ProjectionEqBound ( ProjectionEqBound ) ,
276
276
}
277
277
278
+ pub type QuantifiedInlineBound = Binders < InlineBound > ;
279
+
278
280
impl InlineBound {
279
281
/// Applies the `InlineBound` to `self_ty` and lowers to a [`DomainGoal`].
280
282
///
281
283
/// Because an `InlineBound` does not know anything about what it's binding,
282
284
/// you must provide that type as `self_ty`.
283
- crate fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
285
+ fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
284
286
match self {
285
287
InlineBound :: TraitBound ( b) => b. into_where_clauses ( self_ty) ,
286
288
InlineBound :: ProjectionEqBound ( b) => b. into_where_clauses ( self_ty) ,
287
289
}
288
290
}
289
291
}
290
292
293
+ impl QuantifiedInlineBound {
294
+ crate fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < QuantifiedWhereClause > {
295
+ let self_ty = self_ty. up_shift ( self . binders . len ( ) ) ;
296
+ self . value . into_where_clauses ( self_ty) . into_iter ( ) . map ( |wc| {
297
+ Binders {
298
+ binders : self . binders . clone ( ) ,
299
+ value : wc,
300
+ }
301
+ } ) . collect ( )
302
+ }
303
+ }
304
+
305
+
291
306
/// Represents a trait bound on e.g. a type or type parameter.
292
307
/// Does not know anything about what it's binding.
293
308
#[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
@@ -297,7 +312,7 @@ pub struct TraitBound {
297
312
}
298
313
299
314
impl TraitBound {
300
- crate fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
315
+ fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
301
316
let trait_ref = self . as_trait_ref ( self_ty) ;
302
317
vec ! [ WhereClause :: Implemented ( trait_ref) ]
303
318
}
@@ -310,7 +325,6 @@ impl TraitBound {
310
325
}
311
326
}
312
327
}
313
-
314
328
/// Represents a projection equality bound on e.g. a type or type parameter.
315
329
/// Does not know anything about what it's binding.
316
330
#[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
@@ -323,7 +337,7 @@ pub struct ProjectionEqBound {
323
337
}
324
338
325
339
impl ProjectionEqBound {
326
- crate fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
340
+ fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
327
341
let trait_ref = self . trait_bound . as_trait_ref ( self_ty) ;
328
342
329
343
let mut parameters = self . parameters . clone ( ) ;
@@ -361,7 +375,7 @@ pub struct AssociatedTyDatum {
361
375
///
362
376
/// These must be proven by the implementer, for all possible parameters that
363
377
/// would result in a well-formed projection.
364
- crate bounds : Vec < InlineBound > ,
378
+ crate bounds : Vec < QuantifiedInlineBound > ,
365
379
366
380
/// Where clauses that must hold for the projection to be well-formed.
367
381
crate where_clauses : Vec < QuantifiedWhereClause > ,
@@ -373,7 +387,7 @@ impl AssociatedTyDatum {
373
387
/// ```notrust
374
388
/// Implemented(<?0 as Foo>::Item<?1>: Sized)
375
389
/// ```
376
- crate fn bounds_on_self ( & self ) -> Vec < WhereClause > {
390
+ crate fn bounds_on_self ( & self ) -> Vec < QuantifiedWhereClause > {
377
391
let parameters = self . parameter_kinds
378
392
. anonymize ( )
379
393
. iter ( )
0 commit comments