@@ -335,7 +335,8 @@ fn create_generic_args<'tcx>(
335335 tcx. impl_trait_header ( parent) . unwrap ( ) . trait_ref . instantiate_identity ( ) . args ;
336336
337337 let trait_args = ty:: GenericArgs :: identity_for_item ( tcx, sig_id) ;
338- let method_args = tcx. mk_args_from_iter ( trait_args. iter ( ) . skip ( callee_generics. parent_count ) ) ;
338+ let method_args =
339+ tcx. mk_args_from_iter ( trait_args. iter ( ) . skip ( callee_generics. parent_count ) ) ;
339340 let method_args = builder. build_from_args ( method_args) ;
340341
341342 tcx. mk_args_from_iter ( parent_args. iter ( ) . chain ( method_args) )
@@ -354,9 +355,9 @@ fn create_generic_args<'tcx>(
354355 }
355356
356357 // For trait impl's `sig_id` is always equal to the corresponding trait method.
358+ // For inherent methods delegation is not yet supported.
357359 ( FnKind :: AssocTraitImpl , _)
358360 | ( _, FnKind :: AssocTraitImpl )
359- // Delegation to inherent methods is not yet supported.
360361 | ( _, FnKind :: AssocInherentImpl ) => unreachable ! ( ) ,
361362 }
362363}
@@ -382,29 +383,26 @@ pub(crate) fn inherit_generics_for_delegation_item<'tcx>(
382383 let caller_kind = fn_kind ( tcx, def_id. into ( ) ) ;
383384 let callee_kind = fn_kind ( tcx, sig_id) ;
384385 match ( caller_kind, callee_kind) {
385- ( FnKind :: Free , FnKind :: Free )
386- | ( FnKind :: Free , FnKind :: AssocTrait ) => builder. with_inheritance_kind ( InheritanceKind :: WithParent ( true ) ) . build ( ) ,
386+ ( FnKind :: Free , FnKind :: Free ) | ( FnKind :: Free , FnKind :: AssocTrait ) => {
387+ builder. with_inheritance_kind ( InheritanceKind :: WithParent ( true ) ) . build ( )
388+ }
387389
388- ( FnKind :: AssocTraitImpl , FnKind :: AssocTrait ) => {
389- builder
390+ ( FnKind :: AssocTraitImpl , FnKind :: AssocTrait ) => builder
390391 . with_parent ( tcx. parent ( def_id. into ( ) ) )
391392 . with_inheritance_kind ( InheritanceKind :: Own )
392- . build ( )
393- }
393+ . build ( ) ,
394394
395395 ( FnKind :: AssocInherentImpl , FnKind :: AssocTrait )
396396 | ( FnKind :: AssocTrait , FnKind :: AssocTrait )
397397 | ( FnKind :: AssocInherentImpl , FnKind :: Free )
398398 | ( FnKind :: AssocTrait , FnKind :: Free ) => {
399- builder
400- . with_parent ( tcx. parent ( def_id. into ( ) ) )
401- . build ( )
399+ builder. with_parent ( tcx. parent ( def_id. into ( ) ) ) . build ( )
402400 }
403401
404402 // For trait impl's `sig_id` is always equal to the corresponding trait method.
403+ // For inherent methods delegation is not yet supported.
405404 ( FnKind :: AssocTraitImpl , _)
406405 | ( _, FnKind :: AssocTraitImpl )
407- // Delegation to inherent methods is not yet supported.
408406 | ( _, FnKind :: AssocInherentImpl ) => unreachable ! ( ) ,
409407 }
410408}
@@ -420,31 +418,26 @@ pub(crate) fn inherit_predicates_for_delegation_item<'tcx>(
420418 let caller_kind = fn_kind ( tcx, def_id. into ( ) ) ;
421419 let callee_kind = fn_kind ( tcx, sig_id) ;
422420 match ( caller_kind, callee_kind) {
423- ( FnKind :: Free , FnKind :: Free )
424- | ( FnKind :: Free , FnKind :: AssocTrait ) => {
421+ ( FnKind :: Free , FnKind :: Free ) | ( FnKind :: Free , FnKind :: AssocTrait ) => {
425422 builder. with_inheritance_kind ( InheritanceKind :: WithParent ( true ) ) . build ( )
426423 }
427424
428- ( FnKind :: AssocTraitImpl , FnKind :: AssocTrait ) => {
429- builder
425+ ( FnKind :: AssocTraitImpl , FnKind :: AssocTrait ) => builder
430426 . with_parent ( tcx. parent ( def_id. into ( ) ) )
431427 . with_inheritance_kind ( InheritanceKind :: Own )
432- . build ( )
433- }
428+ . build ( ) ,
434429
435430 ( FnKind :: AssocInherentImpl , FnKind :: AssocTrait )
436431 | ( FnKind :: AssocTrait , FnKind :: AssocTrait )
437432 | ( FnKind :: AssocInherentImpl , FnKind :: Free )
438433 | ( FnKind :: AssocTrait , FnKind :: Free ) => {
439- builder
440- . with_parent ( tcx. parent ( def_id. into ( ) ) )
441- . build ( )
434+ builder. with_parent ( tcx. parent ( def_id. into ( ) ) ) . build ( )
442435 }
443436
444437 // For trait impl's `sig_id` is always equal to the corresponding trait method.
438+ // For inherent methods delegation is not yet supported.
445439 ( FnKind :: AssocTraitImpl , _)
446440 | ( _, FnKind :: AssocTraitImpl )
447- // Delegation to inherent methods is not yet supported.
448441 | ( _, FnKind :: AssocInherentImpl ) => unreachable ! ( ) ,
449442 }
450443}
0 commit comments