Don't use self type for cat_index on overloaded indexing. Fixes #20649.

This commit is contained in:
Luqman Aden 2016-10-11 20:08:26 -04:00
parent bc1cc1db6d
commit c96e3524e3

View File

@ -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 => {