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,