@@ -251,16 +251,15 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
251251 // Rule Normalize-From-Impl (see rustc guide)
252252 //
253253 // ```impl<P0..Pn> Trait<A1..An> for A0
254- // where WC
255254 // {
256- // type AssocType<Pn+1..Pm> where WC1 = T;
255+ // type AssocType<Pn+1..Pm> where WC = T;
257256 // }```
258257 //
259258 // ```
260259 // forall<P0..Pm> {
261260 // forall<Pn+1..Pm> {
262261 // Normalize(<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm> -> T) :-
263- // WC && WC1
262+ // Implemented(A0: Trait<A1..An>) && WC
264263 // }
265264 // }
266265 // ```
@@ -276,19 +275,18 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
276275 let trait_ref = tcx. impl_trait_ref ( impl_id) . unwrap ( ) ;
277276 // `T`
278277 let ty = tcx. type_of ( item_id) ;
278+ // `Implemented(A0: Trait<A1..An>)`
279+ let trait_implemented = ty:: Binder :: dummy ( ty:: TraitPredicate { trait_ref } . lower ( ) ) ;
279280 // `WC`
280- let impl_where_clauses = tcx. predicates_of ( impl_id) . predicates . lower ( ) ;
281- // `WC1`
282281 let item_where_clauses = tcx. predicates_of ( item_id) . predicates . lower ( ) ;
283- // `WC && WC1`
284- let mut where_clauses = vec ! [ ] ;
285- where_clauses. extend ( impl_where_clauses) ;
282+ // `Implemented(A0: Trait<A1..An>) && WC`
283+ let mut where_clauses = vec ! [ trait_implemented] ;
286284 where_clauses. extend ( item_where_clauses) ;
287285 // `<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm>`
288286 let projection_ty = ty:: ProjectionTy :: from_ref_and_name ( tcx, trait_ref, item. name ) ;
289287 // `Normalize(<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm> -> T)`
290288 let normalize_goal = DomainGoal :: Normalize ( ty:: ProjectionPredicate { projection_ty, ty } ) ;
291- // `Normalize(... -> T) :- WC && WC1 `
289+ // `Normalize(... -> T) :- ... `
292290 let clause = ProgramClause {
293291 goal : normalize_goal,
294292 hypotheses : where_clauses. into_iter ( ) . map ( |wc| wc. into ( ) ) . collect ( ) ,
0 commit comments