@@ -3481,31 +3481,30 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3481
3481
errors : & mut Vec < traits:: FulfillmentError < ' _ > > ,
3482
3482
call_expr : & ' tcx hir:: Expr ,
3483
3483
) {
3484
- if let hir:: ExprKind :: Call ( path, _args ) = & call_expr. node {
3484
+ if let hir:: ExprKind :: Call ( path, _ ) = & call_expr. node {
3485
3485
if let hir:: ExprKind :: Path ( qpath) = & path. node {
3486
- if let hir:: QPath :: Resolved ( _self , path) = & qpath {
3486
+ if let hir:: QPath :: Resolved ( _ , path) = & qpath {
3487
3487
for error in errors {
3488
3488
if let ty:: Predicate :: Trait ( predicate) = error. obligation . predicate {
3489
3489
// If any of the type arguments in this path segment caused the
3490
3490
// `FullfillmentError`, point at its span (#61860).
3491
- for segment in & path. segments {
3492
- if let Some ( args) = & segment. args {
3493
- for arg in & args. args {
3494
- if let hir:: GenericArg :: Type ( hir_ty) = & arg {
3495
- if let hir:: TyKind :: Path (
3496
- hir:: QPath :: TypeRelative ( ..) ,
3497
- ) = & hir_ty. node {
3498
- // Avoid ICE with associated types. As this is best
3499
- // effort only, it's ok to ignore the case. It
3500
- // would trigger in `is_send::<T::AssocType>();`
3501
- // from `typeck-default-trait-impl-assoc-type.rs`.
3502
- } else {
3503
- let ty = AstConv :: ast_ty_to_ty ( self , hir_ty) ;
3504
- let ty = self . resolve_vars_if_possible ( & ty) ;
3505
- if ty == predicate. skip_binder ( ) . self_ty ( ) {
3506
- error. obligation . cause . span = hir_ty. span ;
3507
- }
3508
- }
3491
+ for arg in path. segments . iter ( )
3492
+ . filter_map ( |seg| seg. args . as_ref ( ) )
3493
+ . flat_map ( |a| a. args . iter ( ) )
3494
+ {
3495
+ if let hir:: GenericArg :: Type ( hir_ty) = & arg {
3496
+ if let hir:: TyKind :: Path (
3497
+ hir:: QPath :: TypeRelative ( ..) ,
3498
+ ) = & hir_ty. node {
3499
+ // Avoid ICE with associated types. As this is best
3500
+ // effort only, it's ok to ignore the case. It
3501
+ // would trigger in `is_send::<T::AssocType>();`
3502
+ // from `typeck-default-trait-impl-assoc-type.rs`.
3503
+ } else {
3504
+ let ty = AstConv :: ast_ty_to_ty ( self , hir_ty) ;
3505
+ let ty = self . resolve_vars_if_possible ( & ty) ;
3506
+ if ty == predicate. skip_binder ( ) . self_ty ( ) {
3507
+ error. obligation . cause . span = hir_ty. span ;
3509
3508
}
3510
3509
}
3511
3510
}
0 commit comments