@@ -2524,7 +2524,6 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2524
2524
}
2525
2525
2526
2526
let input_ty = fcx. infcx ( ) . next_ty_var ( ) ;
2527
- let return_ty = fcx. infcx ( ) . next_ty_var ( ) ;
2528
2527
2529
2528
// Try `IndexMut` first, if preferred.
2530
2529
let method = match ( lvalue_pref, fcx. tcx ( ) . lang_items . index_mut_trait ( ) ) {
@@ -2536,7 +2535,7 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2536
2535
trait_did,
2537
2536
adjustment. clone ( ) ,
2538
2537
adjusted_ty,
2539
- Some ( vec ! [ input_ty, return_ty ] ) )
2538
+ Some ( vec ! [ input_ty] ) )
2540
2539
}
2541
2540
_ => None ,
2542
2541
} ;
@@ -2551,17 +2550,17 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
2551
2550
trait_did,
2552
2551
adjustment,
2553
2552
adjusted_ty,
2554
- Some ( vec ! [ input_ty, return_ty ] ) )
2553
+ Some ( vec ! [ input_ty] ) )
2555
2554
}
2556
2555
( method, _) => method,
2557
2556
} ;
2558
2557
2559
2558
// If some lookup succeeds, write callee into table and extract index/element
2560
2559
// type from the method signature.
2561
2560
// If some lookup succeeded, install method in table
2562
- method. map ( |method| {
2563
- make_overloaded_lvalue_return_type ( fcx, Some ( method_call) , Some ( method) ) ;
2564
- ( input_ty, return_ty )
2561
+ method. and_then ( |method| {
2562
+ make_overloaded_lvalue_return_type ( fcx, Some ( method_call) , Some ( method) ) .
2563
+ map ( |ret| ( input_ty, ret . ty ) )
2565
2564
} )
2566
2565
}
2567
2566
0 commit comments