@@ -220,7 +220,7 @@ fn type_check_internal<'a, 'tcx, R>(
220220
221221 if !errors_reported {
222222 // if verifier failed, don't do further checks to avoid ICEs
223- checker. typeck_mir ( & body) ;
223+ checker. typeck_mir ( body) ;
224224 }
225225
226226 extra ( & mut checker)
@@ -588,7 +588,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
588588
589589 if !self . errors_reported {
590590 // if verifier failed, don't do further checks to avoid ICEs
591- self . cx . typeck_mir ( & promoted_body) ;
591+ self . cx . typeck_mir ( promoted_body) ;
592592 }
593593
594594 self . body = parent_body;
@@ -1374,7 +1374,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
13741374 self . infcx . tcx
13751375 }
13761376
1377- fn check_stmt ( & mut self , body : & Body < ' tcx > , stmt : & Statement < ' tcx > , location : Location ) {
1377+ fn check_stmt ( & mut self , body : ReadOnlyBodyCache < ' _ , ' tcx > , stmt : & Statement < ' tcx > , location : Location ) {
13781378 debug ! ( "check_stmt: {:?}" , stmt) ;
13791379 let tcx = self . tcx ( ) ;
13801380 match stmt. kind {
@@ -1406,9 +1406,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14061406 _ => ConstraintCategory :: Assignment ,
14071407 } ;
14081408
1409- let place_ty = place. ty ( body, tcx) . ty ;
1409+ let place_ty = place. ty ( body. body ( ) , tcx) . ty ;
14101410 let place_ty = self . normalize ( place_ty, location) ;
1411- let rv_ty = rv. ty ( body, tcx) ;
1411+ let rv_ty = rv. ty ( body. body ( ) , tcx) ;
14121412 let rv_ty = self . normalize ( rv_ty, location) ;
14131413 if let Err ( terr) =
14141414 self . sub_types_or_anon ( rv_ty, place_ty, location. to_locations ( ) , category)
@@ -1460,7 +1460,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14601460 ref place,
14611461 variant_index,
14621462 } => {
1463- let place_type = place. ty ( body, tcx) . ty ;
1463+ let place_type = place. ty ( body. body ( ) , tcx) . ty ;
14641464 let adt = match place_type. kind {
14651465 ty:: Adt ( adt, _) if adt. is_enum ( ) => adt,
14661466 _ => {
@@ -1482,7 +1482,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
14821482 } ;
14831483 }
14841484 StatementKind :: AscribeUserType ( box( ref place, ref projection) , variance) => {
1485- let place_ty = place. ty ( body, tcx) . ty ;
1485+ let place_ty = place. ty ( body. body ( ) , tcx) . ty ;
14861486 if let Err ( terr) = self . relate_type_and_user_type (
14871487 place_ty,
14881488 variance,
@@ -1985,20 +1985,20 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19851985 }
19861986 }
19871987
1988- fn check_rvalue ( & mut self , body : & Body < ' tcx > , rvalue : & Rvalue < ' tcx > , location : Location ) {
1988+ fn check_rvalue ( & mut self , body : ReadOnlyBodyCache < ' _ , ' tcx > , rvalue : & Rvalue < ' tcx > , location : Location ) {
19891989 let tcx = self . tcx ( ) ;
19901990
19911991 match rvalue {
19921992 Rvalue :: Aggregate ( ak, ops) => {
1993- self . check_aggregate_rvalue ( body, rvalue, ak, ops, location)
1993+ self . check_aggregate_rvalue ( & body, rvalue, ak, ops, location)
19941994 }
19951995
19961996 Rvalue :: Repeat ( operand, len) => if * len > 1 {
19971997 if let Operand :: Move ( _) = operand {
19981998 // While this is located in `nll::typeck` this error is not an NLL error, it's
19991999 // a required check to make sure that repeated elements implement `Copy`.
20002000 let span = body. source_info ( location) . span ;
2001- let ty = operand. ty ( body, tcx) ;
2001+ let ty = operand. ty ( body. body ( ) , tcx) ;
20022002 if !self . infcx . type_is_copy_modulo_regions ( self . param_env , ty, span) {
20032003 // To determine if `const_in_array_repeat_expressions` feature gate should
20042004 // be mentioned, need to check if the rvalue is promotable.
@@ -2052,7 +2052,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20522052 Rvalue :: Cast ( cast_kind, op, ty) => {
20532053 match cast_kind {
20542054 CastKind :: Pointer ( PointerCast :: ReifyFnPointer ) => {
2055- let fn_sig = op. ty ( body, tcx) . fn_sig ( tcx) ;
2055+ let fn_sig = op. ty ( body. body ( ) , tcx) . fn_sig ( tcx) ;
20562056
20572057 // The type that we see in the fcx is like
20582058 // `foo::<'a, 'b>`, where `foo` is the path to a
@@ -2081,7 +2081,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20812081 }
20822082
20832083 CastKind :: Pointer ( PointerCast :: ClosureFnPointer ( unsafety) ) => {
2084- let sig = match op. ty ( body, tcx) . kind {
2084+ let sig = match op. ty ( body. body ( ) , tcx) . kind {
20852085 ty:: Closure ( def_id, substs) => {
20862086 substs. as_closure ( ) . sig_ty ( def_id, tcx) . fn_sig ( tcx)
20872087 }
@@ -2107,7 +2107,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21072107 }
21082108
21092109 CastKind :: Pointer ( PointerCast :: UnsafeFnPointer ) => {
2110- let fn_sig = op. ty ( body, tcx) . fn_sig ( tcx) ;
2110+ let fn_sig = op. ty ( body. body ( ) , tcx) . fn_sig ( tcx) ;
21112111
21122112 // The type that we see in the fcx is like
21132113 // `foo::<'a, 'b>`, where `foo` is the path to a
@@ -2139,7 +2139,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21392139 let & ty = ty;
21402140 let trait_ref = ty:: TraitRef {
21412141 def_id : tcx. lang_items ( ) . coerce_unsized_trait ( ) . unwrap ( ) ,
2142- substs : tcx. mk_substs_trait ( op. ty ( body, tcx) , & [ ty. into ( ) ] ) ,
2142+ substs : tcx. mk_substs_trait ( op. ty ( body. body ( ) , tcx) , & [ ty. into ( ) ] ) ,
21432143 } ;
21442144
21452145 self . prove_trait_ref (
@@ -2150,7 +2150,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21502150 }
21512151
21522152 CastKind :: Pointer ( PointerCast :: MutToConstPointer ) => {
2153- let ty_from = match op. ty ( body, tcx) . kind {
2153+ let ty_from = match op. ty ( body. body ( ) , tcx) . kind {
21542154 ty:: RawPtr ( ty:: TypeAndMut {
21552155 ty : ty_from,
21562156 mutbl : hir:: Mutability :: Mutable ,
@@ -2198,7 +2198,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21982198 }
21992199
22002200 CastKind :: Pointer ( PointerCast :: ArrayToPointer ) => {
2201- let ty_from = op. ty ( body, tcx) ;
2201+ let ty_from = op. ty ( body. body ( ) , tcx) ;
22022202
22032203 let opt_ty_elem = match ty_from. kind {
22042204 ty:: RawPtr (
@@ -2260,7 +2260,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22602260 }
22612261
22622262 CastKind :: Misc => {
2263- let ty_from = op. ty ( body, tcx) ;
2263+ let ty_from = op. ty ( body. body ( ) , tcx) ;
22642264 let cast_ty_from = CastTy :: from_ty ( ty_from) ;
22652265 let cast_ty_to = CastTy :: from_ty ( ty) ;
22662266 match ( cast_ty_from, cast_ty_to) {
@@ -2318,7 +2318,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
23182318 }
23192319
23202320 Rvalue :: Ref ( region, _borrow_kind, borrowed_place) => {
2321- self . add_reborrow_constraint ( body, location, region, borrowed_place) ;
2321+ self . add_reborrow_constraint ( & body, location, region, borrowed_place) ;
23222322 }
23232323
23242324 Rvalue :: BinaryOp ( BinOp :: Eq , left, right)
@@ -2327,9 +2327,9 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
23272327 | Rvalue :: BinaryOp ( BinOp :: Le , left, right)
23282328 | Rvalue :: BinaryOp ( BinOp :: Gt , left, right)
23292329 | Rvalue :: BinaryOp ( BinOp :: Ge , left, right) => {
2330- let ty_left = left. ty ( body, tcx) ;
2330+ let ty_left = left. ty ( body. body ( ) , tcx) ;
23312331 if let ty:: RawPtr ( _) | ty:: FnPtr ( _) = ty_left. kind {
2332- let ty_right = right. ty ( body, tcx) ;
2332+ let ty_right = right. ty ( body. body ( ) , tcx) ;
23332333 let common_ty = self . infcx . next_ty_var (
23342334 TypeVariableOrigin {
23352335 kind : TypeVariableOriginKind :: MiscVariable ,
@@ -2754,12 +2754,12 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
27542754 } )
27552755 }
27562756
2757- fn typeck_mir ( & mut self , body : & Body < ' tcx > ) {
2757+ fn typeck_mir ( & mut self , body : ReadOnlyBodyCache < ' _ , ' tcx > ) {
27582758 self . last_span = body. span ;
27592759 debug ! ( "run_on_mir: {:?}" , body. span) ;
27602760
27612761 for ( local, local_decl) in body. local_decls . iter_enumerated ( ) {
2762- self . check_local ( body, local, local_decl) ;
2762+ self . check_local ( & body, local, local_decl) ;
27632763 }
27642764
27652765 for ( block, block_data) in body. basic_blocks ( ) . iter_enumerated ( ) {
@@ -2775,8 +2775,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
27752775 location. statement_index += 1 ;
27762776 }
27772777
2778- self . check_terminator ( body, block_data. terminator ( ) , location) ;
2779- self . check_iscleanup ( body, block_data) ;
2778+ self . check_terminator ( & body, block_data. terminator ( ) , location) ;
2779+ self . check_iscleanup ( & body, block_data) ;
27802780 }
27812781 }
27822782
0 commit comments