Skip to content

Commit fc34330

Browse files
author
Jorge Aparicio
committed
typeck: Index[Mut] traits now have *one* input parameter (not two)
1 parent 7d3c5f0 commit fc34330

File tree

1 file changed

+5
-6
lines changed
  • src/librustc_typeck/check

1 file changed

+5
-6
lines changed

src/librustc_typeck/check/mod.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2524,7 +2524,6 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
25242524
}
25252525

25262526
let input_ty = fcx.infcx().next_ty_var();
2527-
let return_ty = fcx.infcx().next_ty_var();
25282527

25292528
// Try `IndexMut` first, if preferred.
25302529
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>,
25362535
trait_did,
25372536
adjustment.clone(),
25382537
adjusted_ty,
2539-
Some(vec![input_ty, return_ty]))
2538+
Some(vec![input_ty]))
25402539
}
25412540
_ => None,
25422541
};
@@ -2551,17 +2550,17 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
25512550
trait_did,
25522551
adjustment,
25532552
adjusted_ty,
2554-
Some(vec![input_ty, return_ty]))
2553+
Some(vec![input_ty]))
25552554
}
25562555
(method, _) => method,
25572556
};
25582557

25592558
// If some lookup succeeds, write callee into table and extract index/element
25602559
// type from the method signature.
25612560
// 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))
25652564
})
25662565
}
25672566

0 commit comments

Comments
 (0)