@@ -282,32 +282,32 @@ pub fn eval_static_initializer_provider<'tcx>(
282
282
283
283
let instance = ty:: Instance :: mono ( tcx, def_id. to_def_id ( ) ) ;
284
284
let cid = rustc_middle:: mir:: interpret:: GlobalId { instance, promoted : None } ;
285
- let mut ecx = InterpCx :: new (
285
+ let ecx = InterpCx :: new (
286
286
tcx,
287
287
tcx. def_span ( def_id) ,
288
288
ty:: ParamEnv :: reveal_all ( ) ,
289
289
// Statics (and promoteds inside statics) may access other statics, because unlike consts
290
290
// they do not have to behave "as if" they were evaluated at runtime.
291
291
CompileTimeInterpreter :: new ( CanAccessMutGlobal :: Yes , CheckAlignment :: Error ) ,
292
292
) ;
293
- eval_in_interpreter ( & mut ecx, cid, true )
293
+ eval_in_interpreter ( ecx, cid, true )
294
294
}
295
295
296
296
pub trait InterpretationResult < ' tcx > : Sized {
297
297
fn make_result < ' mir > (
298
298
mplace : & MPlaceTy < ' tcx > ,
299
- ecx : & mut InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
299
+ ecx : InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
300
300
cid : GlobalId < ' tcx > ,
301
301
) -> Result < Self , ErrorHandled > ;
302
302
}
303
303
304
304
impl < ' tcx > InterpretationResult < ' tcx > for ConstAlloc < ' tcx > {
305
305
fn make_result < ' mir > (
306
306
mplace : & MPlaceTy < ' tcx > ,
307
- ecx : & mut InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
307
+ ecx : InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
308
308
cid : GlobalId < ' tcx > ,
309
309
) -> Result < Self , ErrorHandled > {
310
- const_validate_mplace ( ecx, mplace, cid) ?;
310
+ const_validate_mplace ( & ecx, mplace, cid) ?;
311
311
Ok ( ConstAlloc {
312
312
alloc_id : mplace. ptr ( ) . provenance . unwrap ( ) . alloc_id ( ) ,
313
313
ty : mplace. layout . ty ,
@@ -342,7 +342,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
342
342
let def = cid. instance . def . def_id ( ) ;
343
343
let is_static = tcx. is_static ( def) ;
344
344
345
- let mut ecx = InterpCx :: new (
345
+ let ecx = InterpCx :: new (
346
346
tcx,
347
347
tcx. def_span ( def) ,
348
348
key. param_env ,
@@ -352,19 +352,19 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
352
352
// so we have to reject reading mutable global memory.
353
353
CompileTimeInterpreter :: new ( CanAccessMutGlobal :: from ( is_static) , CheckAlignment :: Error ) ,
354
354
) ;
355
- eval_in_interpreter ( & mut ecx, cid, is_static)
355
+ eval_in_interpreter ( ecx, cid, is_static)
356
356
}
357
357
358
358
fn eval_in_interpreter < ' mir , ' tcx , R : InterpretationResult < ' tcx > > (
359
- ecx : & mut InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
359
+ mut ecx : InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
360
360
cid : GlobalId < ' tcx > ,
361
361
is_static : bool ,
362
362
) -> Result < R , ErrorHandled > {
363
363
// `is_static` just means "in static", it could still be a promoted!
364
364
debug_assert_eq ! ( is_static, ecx. tcx. static_mutability( cid. instance. def_id( ) ) . is_some( ) ) ;
365
365
366
366
let res = ecx. load_mir ( cid. instance . def , cid. promoted ) ;
367
- match res. and_then ( |body| eval_body_using_ecx ( ecx, cid, body) ) {
367
+ match res. and_then ( |body| eval_body_using_ecx ( & mut ecx, cid, body) ) {
368
368
Err ( error) => {
369
369
let ( error, backtrace) = error. into_parts ( ) ;
370
370
backtrace. print_backtrace ( ) ;
0 commit comments