@@ -128,13 +128,14 @@ impl<I: Interner> ToProgramClauses<I> for AssociatedTyValue<I> {
128
128
}
129
129
130
130
impl < I : Interner > ToProgramClauses < I > for OpaqueTyDatum < I > {
131
- /// Given `opaque type T<.. >: A + B = HiddenTy;`, we generate:
131
+ /// Given `opaque type T<U >: A + B = HiddenTy where U: C ;`, we generate:
132
132
///
133
133
/// ```notrust
134
- /// AliasEq(T<..> = HiddenTy) :- Reveal.
135
- /// AliasEq(T<..> = !T<..>).
136
- /// Implemented(!T<..>: A).
137
- /// Implemented(!T<..>: B).
134
+ /// AliasEq(T<U> = HiddenTy) :- Reveal.
135
+ /// AliasEq(T<U> = !T<U>).
136
+ /// WF(T<U>) :- WF(U: C).
137
+ /// Implemented(!T<U>: A).
138
+ /// Implemented(!T<U>: B).
138
139
/// ```
139
140
/// where `!T<..>` is the placeholder for the unnormalized type `T<..>`.
140
141
#[ instrument( level = "debug" , skip( builder) ) ]
@@ -180,7 +181,17 @@ impl<I: Interner> ToProgramClauses<I> for OpaqueTyDatum<I> {
180
181
. cast ( interner) ,
181
182
) ) ;
182
183
183
- let substitution = Substitution :: from1 ( interner, alias_placeholder_ty. clone ( ) ) ;
184
+ // WF(!T<..>) :- WF(WC).
185
+ builder. push_binders ( & opaque_ty_bound. where_clauses , |builder, where_clauses| {
186
+ builder. push_clause (
187
+ WellFormed :: Ty ( alias_placeholder_ty. clone ( ) ) ,
188
+ where_clauses
189
+ . into_iter ( )
190
+ . map ( |wc| wc. into_well_formed_goal ( interner) ) ,
191
+ ) ;
192
+ } ) ;
193
+
194
+ let substitution = Substitution :: from1 ( interner, alias_placeholder_ty) ;
184
195
for bound in opaque_ty_bound. bounds {
185
196
// Implemented(!T<..>: Bound).
186
197
let bound_with_placeholder_ty = bound. substitute ( interner, & substitution) ;
0 commit comments