From c96e3524e319e3654a5542a3b078c4f7537e94f6 Mon Sep 17 00:00:00 2001 From: Luqman Aden Date: Tue, 11 Oct 2016 20:08:26 -0400 Subject: [PATCH] Don't use self type for cat_index on overloaded indexing. Fixes #20649. --- src/librustc/middle/mem_categorization.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index e3ed13e1e40..fedf8c2ec74 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -945,9 +945,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { let ref_ty = self.overloaded_method_return_ty(method_ty); base_cmt = self.cat_rvalue_node(elt.id(), elt.span(), ref_ty); - // FIXME(#20649) -- why are we using the `self_ty` as the element type...? - let self_ty = method_ty.fn_sig().input(0); - (self.tcx().no_late_bound_regions(&self_ty).unwrap(), + (ref_ty.builtin_deref(false, ty::NoPreference).unwrap().ty, ElementKind::OtherElement) } None => {