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