@@ -42,7 +42,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
42
42
43
43
fn malloc ( & mut self , size : u64 , zero_init : bool , kind : MiriMemoryKind ) -> Scalar < Tag > {
44
44
let this = self . eval_context_mut ( ) ;
45
- let tcx = & { this. tcx . tcx } ;
46
45
if size == 0 {
47
46
Scalar :: from_int ( 0 , this. pointer_size ( ) )
48
47
} else {
@@ -55,7 +54,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
55
54
this. memory
56
55
. get_mut ( ptr. alloc_id )
57
56
. unwrap ( )
58
- . write_repeat ( tcx, ptr, 0 , Size :: from_bytes ( size) )
57
+ . write_repeat ( & * this . tcx , ptr, 0 , Size :: from_bytes ( size) )
59
58
. unwrap ( ) ;
60
59
}
61
60
Scalar :: Ptr ( ptr)
@@ -90,12 +89,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
90
89
}
91
90
} else {
92
91
let old_ptr = this. force_ptr ( old_ptr) ?;
93
- let memory = & mut this. memory ;
94
92
if new_size == 0 {
95
- memory. deallocate ( old_ptr, None , kind. into ( ) ) ?;
93
+ this . memory . deallocate ( old_ptr, None , kind. into ( ) ) ?;
96
94
Ok ( Scalar :: from_int ( 0 , this. pointer_size ( ) ) )
97
95
} else {
98
- let new_ptr = memory. reallocate (
96
+ let new_ptr = this . memory . reallocate (
99
97
old_ptr,
100
98
None ,
101
99
Size :: from_bytes ( new_size) ,
@@ -334,7 +332,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
334
332
// for the TLS destructors, and of course `eval_main`.
335
333
let mir = this. load_mir ( f_instance. def , None ) ?;
336
334
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 ( ) ;
338
336
this. push_stack_frame (
339
337
f_instance,
340
338
mir. span ,
@@ -471,7 +469,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
471
469
"write" => {
472
470
let fd = this. read_scalar ( args[ 0 ] ) ?. to_i32 ( ) ?;
473
471
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) ?;
475
473
trace ! ( "Called write({:?}, {:?}, {:?})" , fd, buf, n) ;
476
474
let result = if fd == 1 || fd == 2 {
477
475
// stdout/stderr
@@ -993,10 +991,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
993
991
994
992
fn set_last_error ( & mut self , scalar : Scalar < Tag > ) -> InterpResult < ' tcx > {
995
993
let this = self . eval_context_mut ( ) ;
996
- let tcx = & { this. tcx . tcx } ;
997
994
let errno_ptr = this. machine . last_error . unwrap ( ) ;
998
995
this. memory . get_mut ( errno_ptr. alloc_id ) ?. write_scalar (
999
- tcx,
996
+ & * this . tcx ,
1000
997
errno_ptr,
1001
998
scalar. into ( ) ,
1002
999
Size :: from_bits ( 32 ) ,
@@ -1005,11 +1002,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1005
1002
1006
1003
fn get_last_error ( & mut self ) -> InterpResult < ' tcx , Scalar < Tag > > {
1007
1004
let this = self . eval_context_mut ( ) ;
1008
- let tcx = & { this. tcx . tcx } ;
1009
1005
let errno_ptr = this. machine . last_error . unwrap ( ) ;
1010
1006
this. memory
1011
1007
. 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 ) ) ?
1013
1009
. not_undef ( )
1014
1010
}
1015
1011
0 commit comments