File tree 1 file changed +24
-8
lines changed
1 file changed +24
-8
lines changed Original file line number Diff line number Diff line change 1
1
use cast:: { Cast , Caster } ;
2
2
use fold:: shift:: Shift ;
3
+ use fold:: Subst ;
3
4
use ir:: { self , ToParameter } ;
4
5
use std:: iter;
5
6
@@ -192,20 +193,35 @@ impl ir::AssociatedTyValue {
192
193
. cloned ( )
193
194
. collect ( ) ;
194
195
196
+ let impl_trait_ref = impl_datum. binders
197
+ . value
198
+ . trait_ref
199
+ . trait_ref ( )
200
+ . up_shift ( self . value . len ( ) ) ;
201
+
202
+ let all_parameters: Vec < _ > =
203
+ self . value . binders
204
+ . iter ( )
205
+ . zip ( 0 ..)
206
+ . map ( |p| p. to_parameter ( ) )
207
+ . chain ( impl_trait_ref. parameters . iter ( ) . cloned ( ) )
208
+ . collect ( ) ;
209
+
195
210
// Assemble the full list of conditions for projection to be valid.
196
211
// This comes in two parts, marked as (1) and (2) in example above:
197
212
//
198
213
// 1. require that the trait is implemented
199
214
// 2. any where-clauses from the `type` declaration in the impl
200
- let impl_trait_ref = impl_datum
201
- . binders
202
- . value
203
- . trait_ref
204
- . trait_ref ( )
205
- . up_shift ( self . value . len ( ) ) ;
215
+ let where_clauses =
216
+ associated_ty . where_clauses
217
+ . iter ( )
218
+ . map ( |wc| Subst :: apply ( & all_parameters , wc ) )
219
+ . casted ( ) ;
220
+
206
221
let conditions: Vec < ir:: Goal > =
207
- iter:: once ( impl_trait_ref. clone ( ) . cast ( ) )
208
- . chain ( associated_ty. where_clauses . iter ( ) . cloned ( ) . casted ( ) ) . collect ( ) ;
222
+ where_clauses
223
+ . chain ( Some ( impl_trait_ref. clone ( ) . cast ( ) ) )
224
+ . collect ( ) ;
209
225
210
226
// Bound parameters + `Self` type of the trait-ref
211
227
let parameters: Vec < _ > = {
You can’t perform that action at this time.
0 commit comments