@@ -247,16 +247,15 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
247247 // Rule Normalize-From-Impl (see rustc guide)
248248 //
249249 // ```impl<P0..Pn> Trait<A1..An> for A0
250- // where WC
251250 // {
252- // type AssocType<Pn+1..Pm> where WC1 = T;
251+ // type AssocType<Pn+1..Pm> where WC = T;
253252 // }```
254253 //
255254 // ```
256255 // forall<P0..Pm> {
257256 // forall<Pn+1..Pm> {
258257 // Normalize(<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm> -> T) :-
259- // WC && WC1
258+ // Implemented(A0: Trait<A1..An>) && WC
260259 // }
261260 // }
262261 // ```
@@ -272,19 +271,18 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
272271 let trait_ref = tcx. impl_trait_ref ( impl_id) . unwrap ( ) ;
273272 // `T`
274273 let ty = tcx. type_of ( item_id) ;
274+ // `Implemented(A0: Trait<A1..An>)`
275+ let trait_implemented = ty:: Binder :: dummy ( ty:: TraitPredicate { trait_ref } . lower ( ) ) ;
275276 // `WC`
276- let impl_where_clauses = tcx. predicates_of ( impl_id) . predicates . lower ( ) ;
277- // `WC1`
278277 let item_where_clauses = tcx. predicates_of ( item_id) . predicates . lower ( ) ;
279- // `WC && WC1`
280- let mut where_clauses = vec ! [ ] ;
281- where_clauses. extend ( impl_where_clauses) ;
278+ // `Implemented(A0: Trait<A1..An>) && WC`
279+ let mut where_clauses = vec ! [ trait_implemented] ;
282280 where_clauses. extend ( item_where_clauses) ;
283281 // `<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm>`
284282 let projection_ty = ty:: ProjectionTy :: from_ref_and_name ( tcx, trait_ref, item. name ) ;
285283 // `Normalize(<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm> -> T)`
286284 let normalize_goal = DomainGoal :: Normalize ( ty:: ProjectionPredicate { projection_ty, ty } ) ;
287- // `Normalize(... -> T) :- WC && WC1 `
285+ // `Normalize(... -> T) :- ... `
288286 let clause = ProgramClause {
289287 goal : normalize_goal,
290288 hypotheses : where_clauses. into_iter ( ) . map ( |wc| wc. into ( ) ) . collect ( ) ,
0 commit comments