@@ -387,48 +387,61 @@ where
387
387
G :: consider_auto_trait_candidate ( self , goal)
388
388
} else if cx. trait_is_alias ( trait_def_id) {
389
389
G :: consider_trait_alias_candidate ( self , goal)
390
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: Sized ) {
391
- G :: consider_builtin_sized_candidate ( self , goal)
392
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: Copy )
393
- || cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: Clone )
394
- {
395
- G :: consider_builtin_copy_clone_candidate ( self , goal)
396
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: PointerLike ) {
397
- G :: consider_builtin_pointer_like_candidate ( self , goal)
398
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: FnPtrTrait ) {
399
- G :: consider_builtin_fn_ptr_trait_candidate ( self , goal)
400
390
} else if let Some ( kind) = self . cx ( ) . fn_trait_kind_from_def_id ( trait_def_id) {
401
391
G :: consider_builtin_fn_trait_candidates ( self , goal, kind)
402
392
} else if let Some ( kind) = self . cx ( ) . async_fn_trait_kind_from_def_id ( trait_def_id) {
403
393
G :: consider_builtin_async_fn_trait_candidates ( self , goal, kind)
404
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: AsyncFnKindHelper ) {
405
- G :: consider_builtin_async_fn_kind_helper_candidate ( self , goal)
406
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: Tuple ) {
407
- G :: consider_builtin_tuple_candidate ( self , goal)
408
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: PointeeTrait ) {
409
- G :: consider_builtin_pointee_candidate ( self , goal)
410
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: Future ) {
411
- G :: consider_builtin_future_candidate ( self , goal)
412
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: Iterator ) {
413
- G :: consider_builtin_iterator_candidate ( self , goal)
414
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: FusedIterator ) {
415
- G :: consider_builtin_fused_iterator_candidate ( self , goal)
416
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: AsyncIterator ) {
417
- G :: consider_builtin_async_iterator_candidate ( self , goal)
418
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: Coroutine ) {
419
- G :: consider_builtin_coroutine_candidate ( self , goal)
420
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: DiscriminantKind ) {
421
- G :: consider_builtin_discriminant_kind_candidate ( self , goal)
422
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: AsyncDestruct ) {
423
- G :: consider_builtin_async_destruct_candidate ( self , goal)
424
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: Destruct ) {
425
- G :: consider_builtin_destruct_candidate ( self , goal)
426
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: TransmuteTrait ) {
427
- G :: consider_builtin_transmute_candidate ( self , goal)
428
- } else if cx. is_lang_item ( trait_def_id, TraitSolverLangItem :: EffectsIntersection ) {
429
- G :: consider_builtin_effects_intersection_candidate ( self , goal)
430
394
} else {
431
- Err ( NoSolution )
395
+ match cx. as_lang_item ( trait_def_id) {
396
+ Some ( TraitSolverLangItem :: Sized ) => G :: consider_builtin_sized_candidate ( self , goal) ,
397
+ Some ( TraitSolverLangItem :: Copy | TraitSolverLangItem :: Clone ) => {
398
+ G :: consider_builtin_copy_clone_candidate ( self , goal)
399
+ }
400
+ Some ( TraitSolverLangItem :: PointerLike ) => {
401
+ G :: consider_builtin_pointer_like_candidate ( self , goal)
402
+ }
403
+ Some ( TraitSolverLangItem :: FnPtrTrait ) => {
404
+ G :: consider_builtin_fn_ptr_trait_candidate ( self , goal)
405
+ }
406
+ Some ( TraitSolverLangItem :: AsyncFnKindHelper ) => {
407
+ G :: consider_builtin_async_fn_kind_helper_candidate ( self , goal)
408
+ }
409
+ Some ( TraitSolverLangItem :: Tuple ) => G :: consider_builtin_tuple_candidate ( self , goal) ,
410
+ Some ( TraitSolverLangItem :: PointeeTrait ) => {
411
+ G :: consider_builtin_pointee_candidate ( self , goal)
412
+ }
413
+ Some ( TraitSolverLangItem :: Future ) => {
414
+ G :: consider_builtin_future_candidate ( self , goal)
415
+ }
416
+ Some ( TraitSolverLangItem :: Iterator ) => {
417
+ G :: consider_builtin_iterator_candidate ( self , goal)
418
+ }
419
+ Some ( TraitSolverLangItem :: FusedIterator ) => {
420
+ G :: consider_builtin_fused_iterator_candidate ( self , goal)
421
+ }
422
+ Some ( TraitSolverLangItem :: AsyncIterator ) => {
423
+ G :: consider_builtin_async_iterator_candidate ( self , goal)
424
+ }
425
+ Some ( TraitSolverLangItem :: Coroutine ) => {
426
+ G :: consider_builtin_coroutine_candidate ( self , goal)
427
+ }
428
+ Some ( TraitSolverLangItem :: DiscriminantKind ) => {
429
+ G :: consider_builtin_discriminant_kind_candidate ( self , goal)
430
+ }
431
+ Some ( TraitSolverLangItem :: AsyncDestruct ) => {
432
+ G :: consider_builtin_async_destruct_candidate ( self , goal)
433
+ }
434
+ Some ( TraitSolverLangItem :: Destruct ) => {
435
+ G :: consider_builtin_destruct_candidate ( self , goal)
436
+ }
437
+ Some ( TraitSolverLangItem :: TransmuteTrait ) => {
438
+ G :: consider_builtin_transmute_candidate ( self , goal)
439
+ }
440
+ Some ( TraitSolverLangItem :: EffectsIntersection ) => {
441
+ G :: consider_builtin_effects_intersection_candidate ( self , goal)
442
+ }
443
+ _ => Err ( NoSolution ) ,
444
+ }
432
445
} ;
433
446
434
447
candidates. extend ( result) ;
0 commit comments