11
11
use super :: { probe, MethodCallee } ;
12
12
13
13
use astconv:: AstConv ;
14
- use check:: { FnCtxt , LvalueOp , callee, Needs } ;
14
+ use check:: { FnCtxt , PlaceOp , callee, Needs } ;
15
15
use hir:: def_id:: DefId ;
16
16
use rustc:: ty:: subst:: Substs ;
17
17
use rustc:: traits;
@@ -438,7 +438,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
438
438
debug ! ( "convert_lvalue_derefs_to_mutable: i={} expr={:?}" , i, expr) ;
439
439
440
440
// Fix up the autoderefs. Autorefs can only occur immediately preceding
441
- // overloaded lvalue ops, and will be fixed by them in order to get
441
+ // overloaded place ops, and will be fixed by them in order to get
442
442
// the correct region.
443
443
let mut source = self . node_ty ( expr. hir_id ) ;
444
444
// Do not mutate adjustments in place, but rather take them,
@@ -470,53 +470,53 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
470
470
match expr. node {
471
471
hir:: ExprIndex ( ref base_expr, ref index_expr) => {
472
472
let index_expr_ty = self . node_ty ( index_expr. hir_id ) ;
473
- self . convert_lvalue_op_to_mutable (
474
- LvalueOp :: Index , expr, base_expr, & [ index_expr_ty] ) ;
473
+ self . convert_place_op_to_mutable (
474
+ PlaceOp :: Index , expr, base_expr, & [ index_expr_ty] ) ;
475
475
}
476
476
hir:: ExprUnary ( hir:: UnDeref , ref base_expr) => {
477
- self . convert_lvalue_op_to_mutable (
478
- LvalueOp :: Deref , expr, base_expr, & [ ] ) ;
477
+ self . convert_place_op_to_mutable (
478
+ PlaceOp :: Deref , expr, base_expr, & [ ] ) ;
479
479
}
480
480
_ => { }
481
481
}
482
482
}
483
483
}
484
484
485
- fn convert_lvalue_op_to_mutable ( & self ,
486
- op : LvalueOp ,
485
+ fn convert_place_op_to_mutable ( & self ,
486
+ op : PlaceOp ,
487
487
expr : & hir:: Expr ,
488
488
base_expr : & hir:: Expr ,
489
489
arg_tys : & [ Ty < ' tcx > ] )
490
490
{
491
- debug ! ( "convert_lvalue_op_to_mutable ({:?}, {:?}, {:?}, {:?})" ,
491
+ debug ! ( "convert_place_op_to_mutable ({:?}, {:?}, {:?}, {:?})" ,
492
492
op, expr, base_expr, arg_tys) ;
493
493
if !self . tables . borrow ( ) . is_method_call ( expr) {
494
- debug ! ( "convert_lvalue_op_to_mutable - builtin, nothing to do" ) ;
494
+ debug ! ( "convert_place_op_to_mutable - builtin, nothing to do" ) ;
495
495
return
496
496
}
497
497
498
498
let base_ty = self . tables . borrow ( ) . expr_adjustments ( base_expr) . last ( )
499
499
. map_or_else ( || self . node_ty ( expr. hir_id ) , |adj| adj. target ) ;
500
500
let base_ty = self . resolve_type_vars_if_possible ( & base_ty) ;
501
501
502
- // Need to deref because overloaded lvalue ops take self by-reference.
502
+ // Need to deref because overloaded place ops take self by-reference.
503
503
let base_ty = base_ty. builtin_deref ( false )
504
- . expect ( "lvalue op takes something that is not a ref" )
504
+ . expect ( "place op takes something that is not a ref" )
505
505
. ty ;
506
506
507
- let method = self . try_overloaded_lvalue_op (
507
+ let method = self . try_overloaded_place_op (
508
508
expr. span , base_ty, arg_tys, Needs :: MutPlace , op) ;
509
509
let method = match method {
510
510
Some ( ok) => self . register_infer_ok_obligations ( ok) ,
511
511
None => return self . tcx . sess . delay_span_bug ( expr. span , "re-trying op failed" )
512
512
} ;
513
- debug ! ( "convert_lvalue_op_to_mutable : method={:?}" , method) ;
513
+ debug ! ( "convert_place_op_to_mutable : method={:?}" , method) ;
514
514
self . write_method_call ( expr. hir_id , method) ;
515
515
516
516
let ( region, mutbl) = if let ty:: TyRef ( r, mt) = method. sig . inputs ( ) [ 0 ] . sty {
517
517
( r, mt. mutbl )
518
518
} else {
519
- span_bug ! ( expr. span, "input to lvalue op is not a ref?" ) ;
519
+ span_bug ! ( expr. span, "input to place op is not a ref?" ) ;
520
520
} ;
521
521
522
522
// Convert the autoref in the base expr to mutable with the correct
@@ -529,7 +529,7 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
529
529
let mut source = base_expr_ty;
530
530
for adjustment in & mut adjustments[ ..] {
531
531
if let Adjust :: Borrow ( AutoBorrow :: Ref ( ..) ) = adjustment. kind {
532
- debug ! ( "convert_lvalue_op_to_mutable : converting autoref {:?}" , adjustment) ;
532
+ debug ! ( "convert_place_op_to_mutable : converting autoref {:?}" , adjustment) ;
533
533
adjustment. kind = Adjust :: Borrow ( AutoBorrow :: Ref ( region, mutbl) ) ;
534
534
adjustment. target = self . tcx . mk_ref ( region, ty:: TypeAndMut {
535
535
ty : source,
0 commit comments