@@ -261,14 +261,9 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
261
261
fn elaborate ( & mut self , elaboratable : & O ) {
262
262
let tcx = self . visited . tcx ;
263
263
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) ) => {
272
267
// Negative trait bounds do not imply any supertrait bounds
273
268
if data. polarity == ty:: ImplPolarity :: Negative {
274
269
return ;
@@ -285,16 +280,49 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
285
280
let obligations =
286
281
predicates. predicates . iter ( ) . enumerate ( ) . map ( |( index, & ( clause, span) ) | {
287
282
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 ) ) ,
289
284
span,
290
- bound_clause . rebind ( data) ,
285
+ bound_predicate . rebind ( data) ,
291
286
index,
292
287
)
293
288
} ) ;
294
289
debug ! ( ?data, ?obligations, "super_predicates" ) ;
295
290
self . extend_deduped ( obligations) ;
296
291
}
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
+ ) ) ) => {
298
326
// We know that `T: 'a` for some type `T`. We can
299
327
// often elaborate this. For example, if we know that
300
328
// `[U]: 'a`, that implies that `U: 'a`. Similarly, if
@@ -357,25 +385,15 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
357
385
}
358
386
} )
359
387
. map ( |clause| {
360
- elaboratable. child ( bound_clause . rebind ( clause) . to_predicate ( tcx) )
388
+ elaboratable. child ( bound_predicate . rebind ( clause) . to_predicate ( tcx) )
361
389
} ) ,
362
390
) ;
363
391
}
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
377
395
}
378
- ty:: ClauseKind :: ConstArgHasType ( ..) => {
396
+ ty:: PredicateKind :: Clause ( ty :: ClauseKind :: ConstArgHasType ( ..) ) => {
379
397
// Nothing to elaborate
380
398
}
381
399
}
0 commit comments