@@ -17,7 +17,7 @@ use rustc::hir;
17
17
use rustc:: hir:: def_id:: { DefId , DefIndex } ;
18
18
use rustc:: hir:: intravisit:: { self , NestedVisitorMap , Visitor } ;
19
19
use rustc:: infer:: InferCtxt ;
20
- use rustc:: ty:: { self , Ty , TyCtxt , TypeVariants } ;
20
+ use rustc:: ty:: { self , Ty , TyCtxt } ;
21
21
use rustc:: ty:: adjustment:: { Adjust , Adjustment } ;
22
22
use rustc:: ty:: fold:: { TypeFoldable , TypeFolder } ;
23
23
use rustc:: util:: nodemap:: DefIdSet ;
@@ -174,7 +174,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
174
174
// When unsizing, the final type of the expression is taken
175
175
// from the first argument of the indexing operator, which
176
176
// 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 {
178
178
ref_to. ty
179
179
} else {
180
180
base_ty
@@ -184,9 +184,9 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> {
184
184
let index_ty = tables. expr_ty_adjusted ( & index) ;
185
185
let index_ty = self . fcx . resolve_type_vars_if_possible ( & index_ty) ;
186
186
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
190
190
tables. type_dependent_defs_mut ( ) . remove ( e. hir_id ) ;
191
191
tables. node_substs_mut ( ) . remove ( e. hir_id ) ;
192
192
0 commit comments