@@ -261,14 +261,9 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
261261 fn elaborate ( & mut self , elaboratable : & O ) {
262262 let tcx = self . visited . tcx ;
263263
264- // We only elaborate clauses.
265- let Some ( clause) = elaboratable. predicate ( ) . as_clause ( ) else {
266- return ;
267- } ;
268-
269- let bound_clause = clause. kind ( ) ;
270- match bound_clause. skip_binder ( ) {
271- ty:: ClauseKind :: Trait ( data) => {
264+ let bound_predicate = elaboratable. predicate ( ) . kind ( ) ;
265+ match bound_predicate. skip_binder ( ) {
266+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Trait ( data) ) => {
272267 // Negative trait bounds do not imply any supertrait bounds
273268 if data. polarity == ty:: ImplPolarity :: Negative {
274269 return ;
@@ -285,16 +280,49 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
285280 let obligations =
286281 predicates. predicates . iter ( ) . enumerate ( ) . map ( |( index, & ( clause, span) ) | {
287282 elaboratable. child_with_derived_cause (
288- clause. subst_supertrait ( tcx, & bound_clause . rebind ( data. trait_ref ) ) ,
283+ clause. subst_supertrait ( tcx, & bound_predicate . rebind ( data. trait_ref ) ) ,
289284 span,
290- bound_clause . rebind ( data) ,
285+ bound_predicate . rebind ( data) ,
291286 index,
292287 )
293288 } ) ;
294289 debug ! ( ?data, ?obligations, "super_predicates" ) ;
295290 self . extend_deduped ( obligations) ;
296291 }
297- ty:: ClauseKind :: TypeOutlives ( ty:: OutlivesPredicate ( ty_max, r_min) ) => {
292+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: WellFormed ( ..) ) => {
293+ // Currently, we do not elaborate WF predicates,
294+ // although we easily could.
295+ }
296+ ty:: PredicateKind :: ObjectSafe ( ..) => {
297+ // Currently, we do not elaborate object-safe
298+ // predicates.
299+ }
300+ ty:: PredicateKind :: Subtype ( ..) => {
301+ // Currently, we do not "elaborate" predicates like `X <: Y`,
302+ // though conceivably we might.
303+ }
304+ ty:: PredicateKind :: Coerce ( ..) => {
305+ // Currently, we do not "elaborate" predicates like `X -> Y`,
306+ // though conceivably we might.
307+ }
308+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: Projection ( ..) ) => {
309+ // Nothing to elaborate in a projection predicate.
310+ }
311+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstEvaluatable ( ..) ) => {
312+ // Currently, we do not elaborate const-evaluatable
313+ // predicates.
314+ }
315+ ty:: PredicateKind :: ConstEquate ( ..) => {
316+ // Currently, we do not elaborate const-equate
317+ // predicates.
318+ }
319+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: RegionOutlives ( ..) ) => {
320+ // Nothing to elaborate from `'a: 'b`.
321+ }
322+ ty:: PredicateKind :: Clause ( ty:: ClauseKind :: TypeOutlives ( ty:: OutlivesPredicate (
323+ ty_max,
324+ r_min,
325+ ) ) ) => {
298326 // We know that `T: 'a` for some type `T`. We can
299327 // often elaborate this. For example, if we know that
300328 // `[U]: 'a`, that implies that `U: 'a`. Similarly, if
@@ -357,25 +385,15 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
357385 }
358386 } )
359387 . map ( |clause| {
360- elaboratable. child ( bound_clause . rebind ( clause) . to_predicate ( tcx) )
388+ elaboratable. child ( bound_predicate . rebind ( clause) . to_predicate ( tcx) )
361389 } ) ,
362390 ) ;
363391 }
364- ty:: ClauseKind :: RegionOutlives ( ..) => {
365- // Nothing to elaborate from `'a: 'b`.
366- }
367- ty:: ClauseKind :: WellFormed ( ..) => {
368- // Currently, we do not elaborate WF predicates,
369- // although we easily could.
370- }
371- ty:: ClauseKind :: Projection ( ..) => {
372- // Nothing to elaborate in a projection predicate.
373- }
374- ty:: ClauseKind :: ConstEvaluatable ( ..) => {
375- // Currently, we do not elaborate const-evaluatable
376- // predicates.
392+ ty:: PredicateKind :: Ambiguous => { }
393+ ty:: PredicateKind :: NormalizesTo ( ..) | ty:: PredicateKind :: AliasRelate ( ..) => {
394+ // No
377395 }
378- ty:: ClauseKind :: ConstArgHasType ( ..) => {
396+ ty:: PredicateKind :: Clause ( ty :: ClauseKind :: ConstArgHasType ( ..) ) => {
379397 // Nothing to elaborate
380398 }
381399 }
0 commit comments