]> git.lizzy.rs Git - rust.git/commitdiff
Use expr_ty_adjusted in convert_place_op_to_mutable
authorGary Guo <gary@garyguo.net>
Mon, 15 Jun 2020 14:59:51 +0000 (15:59 +0100)
committerGary Guo <gary@garyguo.net>
Mon, 15 Jun 2020 14:59:51 +0000 (15:59 +0100)
src/librustc_typeck/check/reconciliation.rs

index b05155ae2aedd43e3152924385b1c35d241a8742..0a4293140a82af250f28be3ffce27d70eed116c9 100644 (file)
@@ -89,17 +89,14 @@ fn convert_place_op_to_mutable(
             return;
         }
 
+        // Need to deref because overloaded place ops take self by-reference.
         let base_ty = self
             .tables
             .borrow()
-            .expr_adjustments(base_expr)
-            .last()
-            .map_or_else(|| self.node_ty(expr.hir_id), |adj| adj.target);
-        let base_ty = self.resolve_vars_if_possible(&base_ty);
-
-        // Need to deref because overloaded place ops take self by-reference.
-        let base_ty =
-            base_ty.builtin_deref(false).expect("place op takes something that is not a ref").ty;
+            .expr_ty_adjusted(base_expr)
+            .builtin_deref(false)
+            .expect("place op takes something that is not a ref")
+            .ty;
 
         let method = self.try_overloaded_place_op(expr.span, base_ty, arg_tys, Needs::MutPlace, op);
         let method = match method {