@@ -282,32 +282,32 @@ pub fn eval_static_initializer_provider<'tcx>(
282282
283283 let instance = ty:: Instance :: mono ( tcx, def_id. to_def_id ( ) ) ;
284284 let cid = rustc_middle:: mir:: interpret:: GlobalId { instance, promoted : None } ;
285- let mut ecx = InterpCx :: new (
285+ let ecx = InterpCx :: new (
286286 tcx,
287287 tcx. def_span ( def_id) ,
288288 ty:: ParamEnv :: reveal_all ( ) ,
289289 // Statics (and promoteds inside statics) may access other statics, because unlike consts
290290 // they do not have to behave "as if" they were evaluated at runtime.
291291 CompileTimeInterpreter :: new ( CanAccessMutGlobal :: Yes , CheckAlignment :: Error ) ,
292292 ) ;
293- eval_in_interpreter ( & mut ecx, cid, true )
293+ eval_in_interpreter ( ecx, cid, true )
294294}
295295
296296pub trait InterpretationResult < ' tcx > : Sized {
297297 fn make_result < ' mir > (
298298 mplace : & MPlaceTy < ' tcx > ,
299- ecx : & mut InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
299+ ecx : InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
300300 cid : GlobalId < ' tcx > ,
301301 ) -> Result < Self , ErrorHandled > ;
302302}
303303
304304impl < ' tcx > InterpretationResult < ' tcx > for ConstAlloc < ' tcx > {
305305 fn make_result < ' mir > (
306306 mplace : & MPlaceTy < ' tcx > ,
307- ecx : & mut InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
307+ ecx : InterpCx < ' mir , ' tcx , CompileTimeInterpreter < ' mir , ' tcx > > ,
308308 cid : GlobalId < ' tcx > ,
309309 ) -> Result < Self , ErrorHandled > {
310- const_validate_mplace ( ecx, mplace, cid) ?;
310+ const_validate_mplace ( & ecx, mplace, cid) ?;
311311 Ok ( ConstAlloc {
312312 alloc_id : mplace. ptr ( ) . provenance . unwrap ( ) . alloc_id ( ) ,
313313 ty : mplace. layout . ty ,
@@ -342,7 +342,7 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
342342 let def = cid. instance . def . def_id ( ) ;
343343 let is_static = tcx. is_static ( def) ;
344344
345- let mut ecx = InterpCx :: new (
345+ let ecx = InterpCx :: new (
346346 tcx,
347347 tcx. def_span ( def) ,
348348 key. param_env ,
@@ -352,19 +352,19 @@ pub fn eval_to_allocation_raw_provider<'tcx>(
352352 // so we have to reject reading mutable global memory.
353353 CompileTimeInterpreter :: new ( CanAccessMutGlobal :: from ( is_static) , CheckAlignment :: Error ) ,
354354 ) ;
355- eval_in_interpreter ( & mut ecx, cid, is_static)
355+ eval_in_interpreter ( ecx, cid, is_static)
356356}
357357
358358fn 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 > > ,
360360 cid : GlobalId < ' tcx > ,
361361 is_static : bool ,
362362) -> Result < R , ErrorHandled > {
363363 // `is_static` just means "in static", it could still be a promoted!
364364 debug_assert_eq ! ( is_static, ecx. tcx. static_mutability( cid. instance. def_id( ) ) . is_some( ) ) ;
365365
366366 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) ) {
368368 Err ( error) => {
369369 let ( error, backtrace) = error. into_parts ( ) ;
370370 backtrace. print_backtrace ( ) ;
0 commit comments