@@ -211,7 +211,6 @@ fn program_clauses_for_trait<'a, 'tcx>(
211
211
let where_clauses = & predicates
212
212
. iter ( )
213
213
. map ( |( wc, _) | wc. lower ( ) )
214
- . map ( |wc| wc. subst ( tcx, bound_vars) )
215
214
. collect :: < Vec < _ > > ( ) ;
216
215
217
216
// Rule Implied-Bound-From-Trait
@@ -232,14 +231,13 @@ fn program_clauses_for_trait<'a, 'tcx>(
232
231
. map ( |wc| {
233
232
// we move binders to the left
234
233
wc. map_bound ( |goal| ProgramClause {
235
- goal : goal. into_from_env_goal ( ) ,
236
-
237
- // FIXME: As where clauses can only bind lifetimes for now,
238
- // and that named bound regions have a def-id, it is safe
239
- // to just inject `hypotheses` (which contains named vars bound at index `0`)
240
- // into this binding level. This may change if we ever allow where clauses
241
- // to bind types (e.g., for GATs things), because bound types only use a `BoundVar`
234
+ // FIXME: As where clauses can only bind lifetimes for now, and that named
235
+ // bound regions have a def-id, it is safe to just inject `bound_vars` and
236
+ // `hypotheses` (which contain named vars bound at index `0`) into this
237
+ // binding level. This may change if we ever allow where clauses to bind
238
+ // types (e.g. for GATs things), because bound types only use a `BoundVar`
242
239
// index (no def-id).
240
+ goal : goal. subst ( tcx, bound_vars) . into_from_env_goal ( ) ,
243
241
hypotheses,
244
242
245
243
category : ProgramClauseCategory :: ImpliedBound ,
@@ -346,7 +344,6 @@ pub fn program_clauses_for_type_def<'a, 'tcx>(
346
344
let where_clauses = tcx. predicates_of ( def_id) . predicates
347
345
. iter ( )
348
346
. map ( |( wc, _) | wc. lower ( ) )
349
- . map ( |wc| wc. subst ( tcx, bound_vars) )
350
347
. collect :: < Vec < _ > > ( ) ;
351
348
352
349
// `WellFormed(Ty<...>) :- WC1, ..., WCm`
@@ -355,7 +352,7 @@ pub fn program_clauses_for_type_def<'a, 'tcx>(
355
352
hypotheses : tcx. mk_goals (
356
353
where_clauses
357
354
. iter ( )
358
- . cloned ( )
355
+ . map ( |wc| wc . subst ( tcx , bound_vars ) )
359
356
. map ( |wc| tcx. mk_goal ( GoalKind :: from_poly_domain_goal ( wc, tcx) ) ) ,
360
357
) ,
361
358
category : ProgramClauseCategory :: WellFormed ,
@@ -383,11 +380,10 @@ pub fn program_clauses_for_type_def<'a, 'tcx>(
383
380
. map ( |wc| {
384
381
// move the binders to the left
385
382
wc. map_bound ( |goal| ProgramClause {
386
- goal : goal. into_from_env_goal ( ) ,
387
-
388
- // FIXME: we inject `hypotheses` into this binding level,
389
- // which may be incorrect in the future: see the FIXME in
390
- // `program_clauses_for_trait`
383
+ // FIXME: we inject `bound_vars` and `hypotheses` into this binding
384
+ // level, which may be incorrect in the future: see the FIXME in
385
+ // `program_clauses_for_trait`.
386
+ goal : goal. subst ( tcx, bound_vars) . into_from_env_goal ( ) ,
391
387
hypotheses,
392
388
393
389
category : ProgramClauseCategory :: ImpliedBound ,
0 commit comments