@@ -211,7 +211,6 @@ fn program_clauses_for_trait<'a, 'tcx>(
211211 let where_clauses = & predicates
212212 . iter ( )
213213 . map ( |( wc, _) | wc. lower ( ) )
214- . map ( |wc| wc. subst ( tcx, bound_vars) )
215214 . collect :: < Vec < _ > > ( ) ;
216215
217216 // Rule Implied-Bound-From-Trait
@@ -232,14 +231,13 @@ fn program_clauses_for_trait<'a, 'tcx>(
232231 . map ( |wc| {
233232 // we move binders to the left
234233 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`
242239 // index (no def-id).
240+ goal : goal. subst ( tcx, bound_vars) . into_from_env_goal ( ) ,
243241 hypotheses,
244242
245243 category : ProgramClauseCategory :: ImpliedBound ,
@@ -346,7 +344,6 @@ pub fn program_clauses_for_type_def<'a, 'tcx>(
346344 let where_clauses = tcx. predicates_of ( def_id) . predicates
347345 . iter ( )
348346 . map ( |( wc, _) | wc. lower ( ) )
349- . map ( |wc| wc. subst ( tcx, bound_vars) )
350347 . collect :: < Vec < _ > > ( ) ;
351348
352349 // `WellFormed(Ty<...>) :- WC1, ..., WCm`
@@ -355,7 +352,7 @@ pub fn program_clauses_for_type_def<'a, 'tcx>(
355352 hypotheses : tcx. mk_goals (
356353 where_clauses
357354 . iter ( )
358- . cloned ( )
355+ . map ( |wc| wc . subst ( tcx , bound_vars ) )
359356 . map ( |wc| tcx. mk_goal ( GoalKind :: from_poly_domain_goal ( wc, tcx) ) ) ,
360357 ) ,
361358 category : ProgramClauseCategory :: WellFormed ,
@@ -383,11 +380,10 @@ pub fn program_clauses_for_type_def<'a, 'tcx>(
383380 . map ( |wc| {
384381 // move the binders to the left
385382 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 ( ) ,
391387 hypotheses,
392388
393389 category : ProgramClauseCategory :: ImpliedBound ,
0 commit comments