@@ -61,8 +61,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
6161 ExprKind :: Unary { op, arg } => {
6262 let arg = unpack ! ( block = this. as_operand( block, scope, & arg) ) ;
6363 // Check for -MIN on signed integers
64- if this. hir . check_overflow ( ) && * op == UnOp :: Neg && expr. ty . is_signed ( ) {
65- let bool_ty = this. hir . bool_ty ( ) ;
64+ if this. check_overflow && * op == UnOp :: Neg && expr. ty . is_signed ( ) {
65+ let bool_ty = this. tcx . types . bool ;
6666
6767 let minval = this. minval_literal ( expr_span, expr. ty ) ;
6868 let is_min = this. temp ( bool_ty, expr_span) ;
@@ -105,7 +105,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
105105 // initialize the box contents:
106106 unpack ! (
107107 block = this. expr_into_dest(
108- this. hir . tcx( ) . mk_place_deref( Place :: from( result) ) ,
108+ this. tcx. mk_place_deref( Place :: from( result) ) ,
109109 block,
110110 & value
111111 )
@@ -148,7 +148,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
148148 // to the same MIR as `let x = ();`.
149149
150150 // first process the set of fields
151- let el_ty = expr. ty . sequence_element_type ( this. hir . tcx ( ) ) ;
151+ let el_ty = expr. ty . sequence_element_type ( this. tcx ) ;
152152 let fields: Vec < _ > = fields
153153 . into_iter ( )
154154 . map ( |f| unpack ! ( block = this. as_operand( block, scope, & f) ) )
@@ -221,7 +221,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
221221 block. and ( Rvalue :: Use ( Operand :: Constant ( box Constant {
222222 span : expr_span,
223223 user_ty : None ,
224- literal : ty:: Const :: zero_sized ( this. hir . tcx ( ) , this. hir . tcx ( ) . types . unit ) ,
224+ literal : ty:: Const :: zero_sized ( this. tcx , this. tcx . types . unit ) ,
225225 } ) ) )
226226 }
227227 ExprKind :: Yield { .. }
@@ -273,9 +273,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
273273 rhs : Operand < ' tcx > ,
274274 ) -> BlockAnd < Rvalue < ' tcx > > {
275275 let source_info = self . source_info ( span) ;
276- let bool_ty = self . hir . bool_ty ( ) ;
277- if self . hir . check_overflow ( ) && op. is_checkable ( ) && ty. is_integral ( ) {
278- let result_tup = self . hir . tcx ( ) . intern_tup ( & [ ty, bool_ty] ) ;
276+ let bool_ty = self . tcx . types . bool ;
277+ if self . check_overflow && op. is_checkable ( ) && ty. is_integral ( ) {
278+ let result_tup = self . tcx . intern_tup ( & [ ty, bool_ty] ) ;
279279 let result_value = self . temp ( result_tup, span) ;
280280
281281 self . cfg . push_assign (
@@ -287,7 +287,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
287287 let val_fld = Field :: new ( 0 ) ;
288288 let of_fld = Field :: new ( 1 ) ;
289289
290- let tcx = self . hir . tcx ( ) ;
290+ let tcx = self . tcx ;
291291 let val = tcx. mk_place_field ( result_value, val_fld, ty) ;
292292 let of = tcx. mk_place_field ( result_value, of_fld, bool_ty) ;
293293
@@ -389,7 +389,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
389389 // is same as that of the capture in the parent closure.
390390 PlaceBase :: Upvar { .. } => {
391391 let enclosing_upvars_resolved =
392- arg_place_builder. clone ( ) . into_place ( this. hir . tcx ( ) , this. hir . typeck_results ( ) ) ;
392+ arg_place_builder. clone ( ) . into_place ( this. tcx , this. typeck_results ) ;
393393
394394 match enclosing_upvars_resolved. as_ref ( ) {
395395 PlaceRef {
@@ -426,13 +426,13 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
426426 Mutability :: Mut => BorrowKind :: Mut { allow_two_phase_borrow : false } ,
427427 } ;
428428
429- let arg_place = arg_place_builder. into_place ( this. hir . tcx ( ) , this. hir . typeck_results ( ) ) ;
429+ let arg_place = arg_place_builder. into_place ( this. tcx , this. typeck_results ) ;
430430
431431 this. cfg . push_assign (
432432 block,
433433 source_info,
434434 Place :: from ( temp) ,
435- Rvalue :: Ref ( this. hir . tcx ( ) . lifetimes . re_erased , borrow_kind, arg_place) ,
435+ Rvalue :: Ref ( this. tcx . lifetimes . re_erased , borrow_kind, arg_place) ,
436436 ) ;
437437
438438 // See the comment in `expr_as_temp` and on the `rvalue_scopes` field for why
@@ -447,9 +447,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
447447 // Helper to get a `-1` value of the appropriate type
448448 fn neg_1_literal ( & mut self , span : Span , ty : Ty < ' tcx > ) -> Operand < ' tcx > {
449449 let param_ty = ty:: ParamEnv :: empty ( ) . and ( ty) ;
450- let bits = self . hir . tcx ( ) . layout_of ( param_ty) . unwrap ( ) . size . bits ( ) ;
450+ let bits = self . tcx . layout_of ( param_ty) . unwrap ( ) . size . bits ( ) ;
451451 let n = ( !0u128 ) >> ( 128 - bits) ;
452- let literal = ty:: Const :: from_bits ( self . hir . tcx ( ) , n, param_ty) ;
452+ let literal = ty:: Const :: from_bits ( self . tcx , n, param_ty) ;
453453
454454 self . literal_operand ( span, literal)
455455 }
@@ -458,9 +458,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
458458 fn minval_literal ( & mut self , span : Span , ty : Ty < ' tcx > ) -> Operand < ' tcx > {
459459 assert ! ( ty. is_signed( ) ) ;
460460 let param_ty = ty:: ParamEnv :: empty ( ) . and ( ty) ;
461- let bits = self . hir . tcx ( ) . layout_of ( param_ty) . unwrap ( ) . size . bits ( ) ;
461+ let bits = self . tcx . layout_of ( param_ty) . unwrap ( ) . size . bits ( ) ;
462462 let n = 1 << ( bits - 1 ) ;
463- let literal = ty:: Const :: from_bits ( self . hir . tcx ( ) , n, param_ty) ;
463+ let literal = ty:: Const :: from_bits ( self . tcx , n, param_ty) ;
464464
465465 self . literal_operand ( span, literal)
466466 }
0 commit comments