]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/method/confirm.rs
Ignore arguments when looking for `IndexMut` for subsequent `mut` obligation
[rust.git] / src / librustc_typeck / check / method / confirm.rs
index 64dc34ab3b0a7d0bec9a238e60b594a5b74ed2fc..c4805c54a7d43e80b6bad522a345446f4c6f0b5b 100644 (file)
@@ -468,7 +468,9 @@ fn convert_place_derefs_to_mutable(&self) {
 
             match expr.kind {
                 hir::ExprKind::Index(ref base_expr, ref index_expr) => {
-                    let index_expr_ty = self.node_ty(index_expr.hir_id);
+                    // We need to get the final type in case dereferences were needed for the trait
+                    // to apply (#72002).
+                    let index_expr_ty = self.tables.borrow().expr_ty_adjusted(index_expr);
                     self.convert_place_op_to_mutable(
                         PlaceOp::Index,
                         expr,