@@ -251,16 +251,15 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
251
251
// Rule Normalize-From-Impl (see rustc guide)
252
252
//
253
253
// ```impl<P0..Pn> Trait<A1..An> for A0
254
- // where WC
255
254
// {
256
- // type AssocType<Pn+1..Pm> where WC1 = T;
255
+ // type AssocType<Pn+1..Pm> where WC = T;
257
256
// }```
258
257
//
259
258
// ```
260
259
// forall<P0..Pm> {
261
260
// forall<Pn+1..Pm> {
262
261
// Normalize(<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm> -> T) :-
263
- // WC && WC1
262
+ // Implemented(A0: Trait<A1..An>) && WC
264
263
// }
265
264
// }
266
265
// ```
@@ -276,19 +275,18 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
276
275
let trait_ref = tcx. impl_trait_ref ( impl_id) . unwrap ( ) ;
277
276
// `T`
278
277
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 ( ) ) ;
279
280
// `WC`
280
- let impl_where_clauses = tcx. predicates_of ( impl_id) . predicates . lower ( ) ;
281
- // `WC1`
282
281
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] ;
286
284
where_clauses. extend ( item_where_clauses) ;
287
285
// `<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm>`
288
286
let projection_ty = ty:: ProjectionTy :: from_ref_and_name ( tcx, trait_ref, item. name ) ;
289
287
// `Normalize(<A0 as Trait<A1..An>>::AssocType<Pn+1..Pm> -> T)`
290
288
let normalize_goal = DomainGoal :: Normalize ( ty:: ProjectionPredicate { projection_ty, ty } ) ;
291
- // `Normalize(... -> T) :- WC && WC1 `
289
+ // `Normalize(... -> T) :- ... `
292
290
let clause = ProgramClause {
293
291
goal : normalize_goal,
294
292
hypotheses : where_clauses. into_iter ( ) . map ( |wc| wc. into ( ) ) . collect ( ) ,
0 commit comments