@@ -367,8 +367,7 @@ fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
367
367
match datum. ty . sty {
368
368
// Don't skip a conversion from Box<T> to &T, etc.
369
369
ty:: TyRef ( ..) => {
370
- let method_call = MethodCall :: autoderef ( expr. id , 0 ) ;
371
- if bcx. tcx ( ) . tables . borrow ( ) . method_map . contains_key ( & method_call) {
370
+ if bcx. tcx ( ) . is_overloaded_autoderef ( expr. id , 0 ) {
372
371
// Don't skip an overloaded deref.
373
372
0
374
373
} else {
@@ -1612,9 +1611,7 @@ fn trans_unary<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
1612
1611
// The only overloaded operator that is translated to a datum
1613
1612
// is an overloaded deref, since it is always yields a `&T`.
1614
1613
// Otherwise, we should be in the RvalueDpsExpr path.
1615
- assert ! (
1616
- op == ast:: UnDeref ||
1617
- !ccx. tcx( ) . tables. borrow( ) . method_map. contains_key( & method_call) ) ;
1614
+ assert ! ( op == ast:: UnDeref || !ccx. tcx( ) . is_method_call( expr. id) ) ;
1618
1615
1619
1616
let un_ty = expr_ty ( bcx, expr) ;
1620
1617
@@ -1907,7 +1904,7 @@ fn trans_binary<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
1907
1904
let ccx = bcx. ccx ( ) ;
1908
1905
1909
1906
// if overloaded, would be RvalueDpsExpr
1910
- assert ! ( !ccx. tcx( ) . tables . borrow ( ) . method_map . contains_key ( & MethodCall :: expr( expr . id) ) ) ;
1907
+ assert ! ( !ccx. tcx( ) . is_method_call ( expr. id) ) ;
1911
1908
1912
1909
match op. node {
1913
1910
ast:: BiAnd => {
@@ -2141,7 +2138,7 @@ fn trans_assign_op<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
2141
2138
debug ! ( "trans_assign_op(expr={:?})" , expr) ;
2142
2139
2143
2140
// User-defined operator methods cannot be used with `+=` etc right now
2144
- assert ! ( !bcx. tcx( ) . tables . borrow ( ) . method_map . contains_key ( & MethodCall :: expr( expr . id) ) ) ;
2141
+ assert ! ( !bcx. tcx( ) . is_method_call ( expr. id) ) ;
2145
2142
2146
2143
// Evaluate LHS (destination), which should be an lvalue
2147
2144
let dst_datum = unpack_datum ! ( bcx, trans_to_lvalue( bcx, dst, "assign_op" ) ) ;
@@ -2606,7 +2603,7 @@ enum ExprKind {
2606
2603
}
2607
2604
2608
2605
fn expr_kind ( tcx : & ty:: ctxt , expr : & ast:: Expr ) -> ExprKind {
2609
- if tcx. tables . borrow ( ) . method_map . contains_key ( & MethodCall :: expr ( expr . id ) ) {
2606
+ if tcx. is_method_call ( expr. id ) {
2610
2607
// Overloaded operations are generally calls, and hence they are
2611
2608
// generated via DPS, but there are a few exceptions:
2612
2609
return match expr. node {
0 commit comments