@@ -42,7 +42,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
4242
4343 fn malloc ( & mut self , size : u64 , zero_init : bool , kind : MiriMemoryKind ) -> Scalar < Tag > {
4444 let this = self . eval_context_mut ( ) ;
45- let tcx = & { this. tcx . tcx } ;
4645 if size == 0 {
4746 Scalar :: from_int ( 0 , this. pointer_size ( ) )
4847 } else {
@@ -55,7 +54,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
5554 this. memory
5655 . get_mut ( ptr. alloc_id )
5756 . unwrap ( )
58- . write_repeat ( tcx, ptr, 0 , Size :: from_bytes ( size) )
57+ . write_repeat ( & * this . tcx , ptr, 0 , Size :: from_bytes ( size) )
5958 . unwrap ( ) ;
6059 }
6160 Scalar :: Ptr ( ptr)
@@ -90,12 +89,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
9089 }
9190 } else {
9291 let old_ptr = this. force_ptr ( old_ptr) ?;
93- let memory = & mut this. memory ;
9492 if new_size == 0 {
95- memory. deallocate ( old_ptr, None , kind. into ( ) ) ?;
93+ this . memory . deallocate ( old_ptr, None , kind. into ( ) ) ?;
9694 Ok ( Scalar :: from_int ( 0 , this. pointer_size ( ) ) )
9795 } else {
98- let new_ptr = memory. reallocate (
96+ let new_ptr = this . memory . reallocate (
9997 old_ptr,
10098 None ,
10199 Size :: from_bytes ( new_size) ,
@@ -334,7 +332,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
334332 // for the TLS destructors, and of course `eval_main`.
335333 let mir = this. load_mir ( f_instance. def , None ) ?;
336334 let ret_place =
337- MPlaceTy :: dangling ( this. layout_of ( this . tcx . mk_unit ( ) ) ?, this) . into ( ) ;
335+ MPlaceTy :: dangling ( this. layout_of ( tcx. mk_unit ( ) ) ?, this) . into ( ) ;
338336 this. push_stack_frame (
339337 f_instance,
340338 mir. span ,
@@ -471,7 +469,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
471469 "write" => {
472470 let fd = this. read_scalar ( args[ 0 ] ) ?. to_i32 ( ) ?;
473471 let buf = this. read_scalar ( args[ 1 ] ) ?. not_undef ( ) ?;
474- let n = this. read_scalar ( args[ 2 ] ) ?. to_usize ( & * this . tcx ) ?;
472+ let n = this. read_scalar ( args[ 2 ] ) ?. to_usize ( tcx) ?;
475473 trace ! ( "Called write({:?}, {:?}, {:?})" , fd, buf, n) ;
476474 let result = if fd == 1 || fd == 2 {
477475 // stdout/stderr
@@ -993,10 +991,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
993991
994992 fn set_last_error ( & mut self , scalar : Scalar < Tag > ) -> InterpResult < ' tcx > {
995993 let this = self . eval_context_mut ( ) ;
996- let tcx = & { this. tcx . tcx } ;
997994 let errno_ptr = this. machine . last_error . unwrap ( ) ;
998995 this. memory . get_mut ( errno_ptr. alloc_id ) ?. write_scalar (
999- tcx,
996+ & * this . tcx ,
1000997 errno_ptr,
1001998 scalar. into ( ) ,
1002999 Size :: from_bits ( 32 ) ,
@@ -1005,11 +1002,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
10051002
10061003 fn get_last_error ( & mut self ) -> InterpResult < ' tcx , Scalar < Tag > > {
10071004 let this = self . eval_context_mut ( ) ;
1008- let tcx = & { this. tcx . tcx } ;
10091005 let errno_ptr = this. machine . last_error . unwrap ( ) ;
10101006 this. memory
10111007 . get ( errno_ptr. alloc_id ) ?
1012- . read_scalar ( tcx, errno_ptr, Size :: from_bits ( 32 ) ) ?
1008+ . read_scalar ( & * this . tcx , errno_ptr, Size :: from_bits ( 32 ) ) ?
10131009 . not_undef ( )
10141010 }
10151011
0 commit comments