@@ -282,28 +282,28 @@ 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 > {
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
) -> Self ;
301
301
}
302
302
303
303
impl < ' tcx > InterpretationResult < ' tcx > for ConstAlloc < ' tcx > {
304
304
fn make_result < ' mir > (
305
305
mplace : MPlaceTy < ' tcx > ,
306
- _ecx : & mut InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
306
+ _ecx : InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
307
307
) -> Self {
308
308
ConstAlloc { alloc_id : mplace. ptr ( ) . provenance . unwrap ( ) . alloc_id ( ) , ty : mplace. layout . ty }
309
309
}
@@ -336,7 +336,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
336
336
let def = cid. instance . def . def_id ( ) ;
337
337
let is_static = tcx. is_static ( def) ;
338
338
339
- let mut ecx = InterpCx :: new (
339
+ let ecx = InterpCx :: new (
340
340
tcx,
341
341
tcx. def_span ( def) ,
342
342
key. param_env ,
@@ -346,19 +346,19 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
346
346
// so we have to reject reading mutable global memory.
347
347
CompileTimeInterpreter :: new ( CanAccessMutGlobal :: from ( is_static) , CheckAlignment :: Error ) ,
348
348
) ;
349
- eval_in_interpreter ( & mut ecx, cid, is_static)
349
+ eval_in_interpreter ( ecx, cid, is_static)
350
350
}
351
351
352
352
fn eval_in_interpreter < ' mir , ' tcx , R : InterpretationResult < ' tcx > > (
353
- ecx : & mut InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
353
+ mut ecx : InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
354
354
cid : GlobalId < ' tcx > ,
355
355
is_static : bool ,
356
356
) -> Result < R , ErrorHandled > {
357
357
// `is_static` just means "in static", it could still be a promoted!
358
358
debug_assert_eq ! ( is_static, ecx. tcx. static_mutability( cid. instance. def_id( ) ) . is_some( ) ) ;
359
359
360
360
let res = ecx. load_mir ( cid. instance . def , cid. promoted ) ;
361
- match res. and_then ( |body| eval_body_using_ecx ( ecx, cid, body) ) {
361
+ match res. and_then ( |body| eval_body_using_ecx ( & mut ecx, cid, body) ) {
362
362
Err ( error) => {
363
363
let ( error, backtrace) = error. into_parts ( ) ;
364
364
backtrace. print_backtrace ( ) ;
0 commit comments