@@ -84,7 +84,7 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> {
84
84
85
85
fn visit_rvalue ( & mut self , rvalue : & Rvalue < ' tcx > , location : Location ) {
86
86
self . super_rvalue ( rvalue, location) ;
87
- let rval_ty = rvalue. ty ( & self . mir . local_decls , self . tcx ( ) ) ;
87
+ let rval_ty = rvalue. ty ( self . mir , self . tcx ( ) ) ;
88
88
self . sanitize_type ( rvalue, rval_ty) ;
89
89
}
90
90
@@ -178,7 +178,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
178
178
}
179
179
ProjectionElem :: Index ( ref i) => {
180
180
self . visit_operand ( i, location) ;
181
- let index_ty = i. ty ( & self . mir . local_decls , tcx) ;
181
+ let index_ty = i. ty ( self . mir , tcx) ;
182
182
if index_ty != tcx. types . usize {
183
183
LvalueTy :: Ty {
184
184
ty : span_mirbug_and_err ! ( self , i, "index by non-usize {:?}" , i)
@@ -378,15 +378,15 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
378
378
let tcx = self . tcx ( ) ;
379
379
match stmt. kind {
380
380
StatementKind :: Assign ( ref lv, ref rv) => {
381
- let lv_ty = lv. ty ( & mir. local_decls , tcx) . to_ty ( tcx) ;
382
- let rv_ty = rv. ty ( & mir. local_decls , tcx) ;
381
+ let lv_ty = lv. ty ( mir, tcx) . to_ty ( tcx) ;
382
+ let rv_ty = rv. ty ( mir, tcx) ;
383
383
if let Err ( terr) = self . sub_types ( rv_ty, lv_ty) {
384
384
span_mirbug ! ( self , stmt, "bad assignment ({:?} = {:?}): {:?}" ,
385
385
lv_ty, rv_ty, terr) ;
386
386
}
387
387
}
388
388
StatementKind :: SetDiscriminant { ref lvalue, variant_index } => {
389
- let lvalue_type = lvalue. ty ( & mir. local_decls , tcx) . to_ty ( tcx) ;
389
+ let lvalue_type = lvalue. ty ( mir, tcx) . to_ty ( tcx) ;
390
390
let adt = match lvalue_type. sty {
391
391
TypeVariants :: TyAdt ( adt, _) if adt. is_enum ( ) => adt,
392
392
_ => {
@@ -438,15 +438,15 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
438
438
ref value,
439
439
..
440
440
} => {
441
- let lv_ty = location. ty ( & mir. local_decls , tcx) . to_ty ( tcx) ;
442
- let rv_ty = value. ty ( & mir. local_decls , tcx) ;
441
+ let lv_ty = location. ty ( mir, tcx) . to_ty ( tcx) ;
442
+ let rv_ty = value. ty ( mir, tcx) ;
443
443
if let Err ( terr) = self . sub_types ( rv_ty, lv_ty) {
444
444
span_mirbug ! ( self , term, "bad DropAndReplace ({:?} = {:?}): {:?}" ,
445
445
lv_ty, rv_ty, terr) ;
446
446
}
447
447
}
448
448
TerminatorKind :: SwitchInt { ref discr, switch_ty, .. } => {
449
- let discr_ty = discr. ty ( & mir. local_decls , tcx) ;
449
+ let discr_ty = discr. ty ( mir, tcx) ;
450
450
if let Err ( terr) = self . sub_types ( discr_ty, switch_ty) {
451
451
span_mirbug ! ( self , term, "bad SwitchInt ({:?} on {:?}): {:?}" ,
452
452
switch_ty, discr_ty, terr) ;
@@ -459,7 +459,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
459
459
// FIXME: check the values
460
460
}
461
461
TerminatorKind :: Call { ref func, ref args, ref destination, .. } => {
462
- let func_ty = func. ty ( & mir. local_decls , tcx) ;
462
+ let func_ty = func. ty ( mir, tcx) ;
463
463
debug ! ( "check_terminator: call, func_ty={:?}" , func_ty) ;
464
464
let sig = match func_ty. sty {
465
465
ty:: TyFnDef ( ..) | ty:: TyFnPtr ( _) => func_ty. fn_sig ( tcx) ,
@@ -479,16 +479,16 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
479
479
}
480
480
}
481
481
TerminatorKind :: Assert { ref cond, ref msg, .. } => {
482
- let cond_ty = cond. ty ( & mir. local_decls , tcx) ;
482
+ let cond_ty = cond. ty ( mir, tcx) ;
483
483
if cond_ty != tcx. types . bool {
484
484
span_mirbug ! ( self , term, "bad Assert ({:?}, not bool" , cond_ty) ;
485
485
}
486
486
487
487
if let AssertMessage :: BoundsCheck { ref len, ref index } = * msg {
488
- if len. ty ( & mir. local_decls , tcx) != tcx. types . usize {
488
+ if len. ty ( mir, tcx) != tcx. types . usize {
489
489
span_mirbug ! ( self , len, "bounds-check length non-usize {:?}" , len)
490
490
}
491
- if index. ty ( & mir. local_decls , tcx) != tcx. types . usize {
491
+ if index. ty ( mir, tcx) != tcx. types . usize {
492
492
span_mirbug ! ( self , index, "bounds-check index non-usize {:?}" , index)
493
493
}
494
494
}
@@ -504,7 +504,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
504
504
let tcx = self . tcx ( ) ;
505
505
match * destination {
506
506
Some ( ( ref dest, _) ) => {
507
- let dest_ty = dest. ty ( & mir. local_decls , tcx) . to_ty ( tcx) ;
507
+ let dest_ty = dest. ty ( mir, tcx) . to_ty ( tcx) ;
508
508
if let Err ( terr) = self . sub_types ( sig. output ( ) , dest_ty) {
509
509
span_mirbug ! ( self , term,
510
510
"call dest mismatch ({:?} <- {:?}): {:?}" ,
@@ -532,7 +532,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
532
532
span_mirbug ! ( self , term, "call to {:?} with wrong # of args" , sig) ;
533
533
}
534
534
for ( n, ( fn_arg, op_arg) ) in sig. inputs ( ) . iter ( ) . zip ( args) . enumerate ( ) {
535
- let op_arg_ty = op_arg. ty ( & mir. local_decls , self . tcx ( ) ) ;
535
+ let op_arg_ty = op_arg. ty ( mir, self . tcx ( ) ) ;
536
536
if let Err ( terr) = self . sub_types ( op_arg_ty, fn_arg) {
537
537
span_mirbug ! ( self , term, "bad arg #{:?} ({:?} <- {:?}): {:?}" ,
538
538
n, fn_arg, op_arg_ty, terr) ;
@@ -581,7 +581,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
581
581
return ;
582
582
}
583
583
584
- let ty = args[ 0 ] . ty ( & mir. local_decls , self . tcx ( ) ) ;
584
+ let ty = args[ 0 ] . ty ( mir, self . tcx ( ) ) ;
585
585
let arg_ty = match ty. sty {
586
586
ty:: TyRawPtr ( mt) => mt. ty ,
587
587
ty:: TyAdt ( def, _) if def. is_box ( ) => ty. boxed_ty ( ) ,
0 commit comments