Skip to content

Commit c96e352

Browse files
committed
Don't use self type for cat_index on overloaded indexing. Fixes #20649.
1 parent bc1cc1d commit c96e352

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/librustc/middle/mem_categorization.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -945,9 +945,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> {
945945
let ref_ty = self.overloaded_method_return_ty(method_ty);
946946
base_cmt = self.cat_rvalue_node(elt.id(), elt.span(), ref_ty);
947947

948-
// FIXME(#20649) -- why are we using the `self_ty` as the element type...?
949-
let self_ty = method_ty.fn_sig().input(0);
950-
(self.tcx().no_late_bound_regions(&self_ty).unwrap(),
948+
(ref_ty.builtin_deref(false, ty::NoPreference).unwrap().ty,
951949
ElementKind::OtherElement)
952950
}
953951
None => {

0 commit comments

Comments
 (0)