@@ -282,19 +282,34 @@ pub enum InlineBound {
282
282
ProjectionEqBound ( ProjectionEqBound ) ,
283
283
}
284
284
285
+ pub type QuantifiedInlineBound = Binders < InlineBound > ;
286
+
285
287
impl InlineBound {
286
288
/// Applies the `InlineBound` to `self_ty` and lowers to a [`DomainGoal`].
287
289
///
288
290
/// Because an `InlineBound` does not know anything about what it's binding,
289
291
/// you must provide that type as `self_ty`.
290
- crate fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
292
+ fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
291
293
match self {
292
294
InlineBound :: TraitBound ( b) => b. into_where_clauses ( self_ty) ,
293
295
InlineBound :: ProjectionEqBound ( b) => b. into_where_clauses ( self_ty) ,
294
296
}
295
297
}
296
298
}
297
299
300
+ impl QuantifiedInlineBound {
301
+ crate fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < QuantifiedWhereClause > {
302
+ let self_ty = self_ty. up_shift ( self . binders . len ( ) ) ;
303
+ self . value . into_where_clauses ( self_ty) . into_iter ( ) . map ( |wc| {
304
+ Binders {
305
+ binders : self . binders . clone ( ) ,
306
+ value : wc,
307
+ }
308
+ } ) . collect ( )
309
+ }
310
+ }
311
+
312
+
298
313
/// Represents a trait bound on e.g. a type or type parameter.
299
314
/// Does not know anything about what it's binding.
300
315
#[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
@@ -304,7 +319,7 @@ pub struct TraitBound {
304
319
}
305
320
306
321
impl TraitBound {
307
- crate fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
322
+ fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
308
323
let trait_ref = self . as_trait_ref ( self_ty) ;
309
324
vec ! [ WhereClause :: Implemented ( trait_ref) ]
310
325
}
@@ -317,7 +332,6 @@ impl TraitBound {
317
332
}
318
333
}
319
334
}
320
-
321
335
/// Represents a projection equality bound on e.g. a type or type parameter.
322
336
/// Does not know anything about what it's binding.
323
337
#[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
@@ -330,7 +344,7 @@ pub struct ProjectionEqBound {
330
344
}
331
345
332
346
impl ProjectionEqBound {
333
- crate fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
347
+ fn into_where_clauses ( & self , self_ty : Ty ) -> Vec < WhereClause > {
334
348
let trait_ref = self . trait_bound . as_trait_ref ( self_ty) ;
335
349
336
350
let mut parameters = self . parameters . clone ( ) ;
@@ -368,7 +382,7 @@ pub struct AssociatedTyDatum {
368
382
///
369
383
/// These must be proven by the implementer, for all possible parameters that
370
384
/// would result in a well-formed projection.
371
- crate bounds : Vec < InlineBound > ,
385
+ crate bounds : Vec < QuantifiedInlineBound > ,
372
386
373
387
/// Where clauses that must hold for the projection to be well-formed.
374
388
crate where_clauses : Vec < QuantifiedWhereClause > ,
@@ -380,7 +394,7 @@ impl AssociatedTyDatum {
380
394
/// ```notrust
381
395
/// Implemented(<?0 as Foo>::Item<?1>: Sized)
382
396
/// ```
383
- crate fn bounds_on_self ( & self ) -> Vec < WhereClause > {
397
+ crate fn bounds_on_self ( & self ) -> Vec < QuantifiedWhereClause > {
384
398
let parameters = self . parameter_kinds
385
399
. anonymize ( )
386
400
. iter ( )
0 commit comments