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