@@ -149,7 +149,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
149
149
// If some lookup succeeded, install method in table
150
150
let input_ty = self . next_ty_var ( base_expr. span ) ;
151
151
let method =
152
- self . try_overloaded_place_op ( expr. span , self_ty, & [ input_ty] , PlaceOp :: Index ) ;
152
+ self . try_overloaded_place_op ( expr. span , self_ty, Some ( input_ty) , PlaceOp :: Index ) ;
153
153
154
154
if let Some ( result) = method {
155
155
debug ! ( "try_index_step: success, using overloaded indexing" ) ;
@@ -189,7 +189,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
189
189
& self ,
190
190
span : Span ,
191
191
base_ty : Ty < ' tcx > ,
192
- arg_tys : & [ Ty < ' tcx > ] ,
192
+ opt_rhs_ty : Option < Ty < ' tcx > > ,
193
193
op : PlaceOp ,
194
194
) -> Option < InferOk < ' tcx , MethodCallee < ' tcx > > > {
195
195
debug ! ( "try_overloaded_place_op({:?},{:?},{:?})" , span, base_ty, op) ;
@@ -207,15 +207,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
207
207
Ident :: with_dummy_span ( imm_op) ,
208
208
imm_tr,
209
209
base_ty,
210
- Some ( arg_tys ) ,
210
+ opt_rhs_ty ,
211
211
)
212
212
}
213
213
214
214
fn try_mutable_overloaded_place_op (
215
215
& self ,
216
216
span : Span ,
217
217
base_ty : Ty < ' tcx > ,
218
- arg_tys : & [ Ty < ' tcx > ] ,
218
+ opt_rhs_ty : Option < Ty < ' tcx > > ,
219
219
op : PlaceOp ,
220
220
) -> Option < InferOk < ' tcx , MethodCallee < ' tcx > > > {
221
221
debug ! ( "try_mutable_overloaded_place_op({:?},{:?},{:?})" , span, base_ty, op) ;
@@ -233,7 +233,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
233
233
Ident :: with_dummy_span ( mut_op) ,
234
234
mut_tr,
235
235
base_ty,
236
- Some ( arg_tys ) ,
236
+ opt_rhs_ty ,
237
237
)
238
238
}
239
239
@@ -284,7 +284,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
284
284
&& let Some ( ok) = self . try_mutable_overloaded_place_op (
285
285
expr. span ,
286
286
source,
287
- & [ ] ,
287
+ None ,
288
288
PlaceOp :: Deref ,
289
289
)
290
290
{
@@ -359,8 +359,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
359
359
Some ( self . typeck_results . borrow ( ) . node_args ( expr. hir_id ) . type_at ( 1 ) )
360
360
}
361
361
} ;
362
- let arg_tys = arg_ty. as_slice ( ) ;
363
- let method = self . try_mutable_overloaded_place_op ( expr. span , base_ty, arg_tys, op) ;
362
+ let method = self . try_mutable_overloaded_place_op ( expr. span , base_ty, arg_ty, op) ;
364
363
let method = match method {
365
364
Some ( ok) => self . register_infer_ok_obligations ( ok) ,
366
365
// Couldn't find the mutable variant of the place op, keep the
0 commit comments