about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIsaac van Bakel <ivb@vanbakel.io>2018-01-04 00:12:29 +0000
committerIsaac van Bakel <ivb@vanbakel.io>2018-01-07 01:30:21 +0000
commit137a63c6a2cdc3ccee8911f4ee954f811ff3a591 (patch)
treea91f75c6a9b8f9695155d6c113a9a656754e2a19
parent21ddc181f9318d9358806b6dd8f3c615c979b0bc (diff)
downloadrust-137a63c6a2cdc3ccee8911f4ee954f811ff3a591.tar.gz
rust-137a63c6a2cdc3ccee8911f4ee954f811ff3a591.zip
Made requested changes
-rw-r--r--src/librustc_typeck/check/writeback.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs
index ae8daa86a45..352bebf2ea3 100644
--- a/src/librustc_typeck/check/writeback.rs
+++ b/src/librustc_typeck/check/writeback.rs
@@ -17,7 +17,7 @@ use rustc::hir;
 use rustc::hir::def_id::{DefId, DefIndex};
 use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
 use rustc::infer::InferCtxt;
-use rustc::ty::{self, Ty, TyCtxt, TypeVariants};
+use rustc::ty::{self, Ty, TyCtxt};
 use rustc::ty::adjustment::{Adjust, Adjustment};
 use rustc::ty::fold::{TypeFoldable, TypeFolder};
 use rustc::util::nodemap::DefIdSet;
@@ -174,7 +174,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
                 // When unsizing, the final type of the expression is taken
                 // from the first argument of the indexing operator, which
                 // is a &self, and has to be deconstructed
-                if let TypeVariants::TyRef(_, ref ref_to) = base_ty.sty {
+                if let ty::TyRef(_, ref ref_to) = base_ty.sty {
                     ref_to.ty
                 } else {
                     base_ty
@@ -184,9 +184,9 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
             let index_ty = tables.expr_ty_adjusted(&index);
             let index_ty = self.fcx.resolve_type_vars_if_possible(&index_ty);
 
-            if base_ty.builtin_index().is_some() && index_ty.is_uint() {
-                // Remove the method call record, which blocks use in
-                // constant or static cases
+            if base_ty.builtin_index().is_some() 
+                && index_ty == self.fcx.tcx.types.usize {
+                // Remove the method call record
                 tables.type_dependent_defs_mut().remove(e.hir_id);
                 tables.node_substs_mut().remove(e.hir_id);