Skip to content

Commit 137a63c

Browse files
committed
Made requested changes
1 parent 21ddc18 commit 137a63c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustc_typeck/check/writeback.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc::hir;
1717
use rustc::hir::def_id::{DefId, DefIndex};
1818
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
1919
use rustc::infer::InferCtxt;
20-
use rustc::ty::{self, Ty, TyCtxt, TypeVariants};
20+
use rustc::ty::{self, Ty, TyCtxt};
2121
use rustc::ty::adjustment::{Adjust, Adjustment};
2222
use rustc::ty::fold::{TypeFoldable, TypeFolder};
2323
use rustc::util::nodemap::DefIdSet;
@@ -174,7 +174,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
174174
// When unsizing, the final type of the expression is taken
175175
// from the first argument of the indexing operator, which
176176
// is a &self, and has to be deconstructed
177-
if let TypeVariants::TyRef(_, ref ref_to) = base_ty.sty {
177+
if let ty::TyRef(_, ref ref_to) = base_ty.sty {
178178
ref_to.ty
179179
} else {
180180
base_ty
@@ -184,9 +184,9 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
184184
let index_ty = tables.expr_ty_adjusted(&index);
185185
let index_ty = self.fcx.resolve_type_vars_if_possible(&index_ty);
186186

187-
if base_ty.builtin_index().is_some() && index_ty.is_uint() {
188-
// Remove the method call record, which blocks use in
189-
// constant or static cases
187+
if base_ty.builtin_index().is_some()
188+
&& index_ty == self.fcx.tcx.types.usize {
189+
// Remove the method call record
190190
tables.type_dependent_defs_mut().remove(e.hir_id);
191191
tables.node_substs_mut().remove(e.hir_id);
192192

0 commit comments

Comments
 (0)