@@ -17,7 +17,7 @@ use rustc_span::def_id::LocalDefId;
17
17
use rustc_span:: { Span , DUMMY_SP } ;
18
18
use rustc_target:: abi:: { self , Abi } ;
19
19
20
- use super :: { CanAccessMutGlobal , CompileTimeEvalContext , CompileTimeInterpreter } ;
20
+ use super :: { CanAccessMutGlobal , CompileTimeInterpCx , CompileTimeMachine } ;
21
21
use crate :: const_eval:: CheckAlignment ;
22
22
use crate :: errors:: ConstEvalError ;
23
23
use crate :: errors:: { self , DanglingPtrInFinal } ;
@@ -32,7 +32,7 @@ use crate::CTRL_C_RECEIVED;
32
32
// Returns a pointer to where the result lives
33
33
#[ instrument( level = "trace" , skip( ecx, body) ) ]
34
34
fn eval_body_using_ecx < ' tcx , R : InterpretationResult < ' tcx > > (
35
- ecx : & mut CompileTimeEvalContext < ' tcx > ,
35
+ ecx : & mut CompileTimeInterpCx < ' tcx > ,
36
36
cid : GlobalId < ' tcx > ,
37
37
body : & ' tcx mir:: Body < ' tcx > ,
38
38
) -> InterpResult < ' tcx , R > {
@@ -114,7 +114,7 @@ fn eval_body_using_ecx<'tcx, R: InterpretationResult<'tcx>>(
114
114
let err_diag = errors:: MutablePtrInFinal { span : ecx. tcx . span , kind : intern_kind } ;
115
115
ecx. tcx . emit_node_span_lint (
116
116
lint:: builtin:: CONST_EVAL_MUTABLE_PTR_IN_FINAL_VALUE ,
117
- ecx. best_lint_scope ( ) ,
117
+ ecx. machine . best_lint_scope ( * ecx . tcx ) ,
118
118
err_diag. span ,
119
119
err_diag,
120
120
)
@@ -139,13 +139,13 @@ pub(crate) fn mk_eval_cx_to_read_const_val<'tcx>(
139
139
root_span : Span ,
140
140
param_env : ty:: ParamEnv < ' tcx > ,
141
141
can_access_mut_global : CanAccessMutGlobal ,
142
- ) -> CompileTimeEvalContext < ' tcx > {
142
+ ) -> CompileTimeInterpCx < ' tcx > {
143
143
debug ! ( "mk_eval_cx: {:?}" , param_env) ;
144
144
InterpCx :: new (
145
145
tcx,
146
146
root_span,
147
147
param_env,
148
- CompileTimeInterpreter :: new ( can_access_mut_global, CheckAlignment :: No ) ,
148
+ CompileTimeMachine :: new ( can_access_mut_global, CheckAlignment :: No ) ,
149
149
)
150
150
}
151
151
@@ -156,7 +156,7 @@ pub fn mk_eval_cx_for_const_val<'tcx>(
156
156
param_env : ty:: ParamEnv < ' tcx > ,
157
157
val : mir:: ConstValue < ' tcx > ,
158
158
ty : Ty < ' tcx > ,
159
- ) -> Option < ( CompileTimeEvalContext < ' tcx > , OpTy < ' tcx > ) > {
159
+ ) -> Option < ( CompileTimeInterpCx < ' tcx > , OpTy < ' tcx > ) > {
160
160
let ecx = mk_eval_cx_to_read_const_val ( tcx. tcx , tcx. span , param_env, CanAccessMutGlobal :: No ) ;
161
161
let op = ecx. const_val_to_op ( val, ty, None ) . ok ( ) ?;
162
162
Some ( ( ecx, op) )
@@ -170,7 +170,7 @@ pub fn mk_eval_cx_for_const_val<'tcx>(
170
170
/// encounter an `Indirect` they cannot handle.
171
171
#[ instrument( skip( ecx) , level = "debug" ) ]
172
172
pub ( super ) fn op_to_const < ' tcx > (
173
- ecx : & CompileTimeEvalContext < ' tcx > ,
173
+ ecx : & CompileTimeInterpCx < ' tcx > ,
174
174
op : & OpTy < ' tcx > ,
175
175
for_diagnostics : bool ,
176
176
) -> ConstValue < ' tcx > {
@@ -328,14 +328,14 @@ pub trait InterpretationResult<'tcx> {
328
328
/// evaluation query.
329
329
fn make_result (
330
330
mplace : MPlaceTy < ' tcx > ,
331
- ecx : & mut InterpCx < ' tcx , CompileTimeInterpreter < ' tcx > > ,
331
+ ecx : & mut InterpCx < ' tcx , CompileTimeMachine < ' tcx > > ,
332
332
) -> Self ;
333
333
}
334
334
335
335
impl < ' tcx > InterpretationResult < ' tcx > for ConstAlloc < ' tcx > {
336
336
fn make_result (
337
337
mplace : MPlaceTy < ' tcx > ,
338
- _ecx : & mut InterpCx < ' tcx , CompileTimeInterpreter < ' tcx > > ,
338
+ _ecx : & mut InterpCx < ' tcx , CompileTimeMachine < ' tcx > > ,
339
339
) -> Self {
340
340
ConstAlloc { alloc_id : mplace. ptr ( ) . provenance . unwrap ( ) . alloc_id ( ) , ty : mplace. layout . ty }
341
341
}
@@ -383,7 +383,7 @@ fn eval_in_interpreter<'tcx, R: InterpretationResult<'tcx>>(
383
383
// they do not have to behave "as if" they were evaluated at runtime.
384
384
// For consts however we want to ensure they behave "as if" they were evaluated at runtime,
385
385
// so we have to reject reading mutable global memory.
386
- CompileTimeInterpreter :: new ( CanAccessMutGlobal :: from ( is_static) , CheckAlignment :: Error ) ,
386
+ CompileTimeMachine :: new ( CanAccessMutGlobal :: from ( is_static) , CheckAlignment :: Error ) ,
387
387
) ;
388
388
let res = ecx. load_mir ( cid. instance . def , cid. promoted ) ;
389
389
res. and_then ( |body| eval_body_using_ecx ( & mut ecx, cid, body) ) . map_err ( |error| {
@@ -417,7 +417,7 @@ fn eval_in_interpreter<'tcx, R: InterpretationResult<'tcx>>(
417
417
418
418
#[ inline( always) ]
419
419
fn const_validate_mplace < ' tcx > (
420
- ecx : & InterpCx < ' tcx , CompileTimeInterpreter < ' tcx > > ,
420
+ ecx : & InterpCx < ' tcx , CompileTimeMachine < ' tcx > > ,
421
421
mplace : & MPlaceTy < ' tcx > ,
422
422
cid : GlobalId < ' tcx > ,
423
423
) -> Result < ( ) , ErrorHandled > {
@@ -447,7 +447,7 @@ fn const_validate_mplace<'tcx>(
447
447
448
448
#[ inline( always) ]
449
449
fn report_validation_error < ' tcx > (
450
- ecx : & InterpCx < ' tcx , CompileTimeInterpreter < ' tcx > > ,
450
+ ecx : & InterpCx < ' tcx , CompileTimeMachine < ' tcx > > ,
451
451
error : InterpErrorInfo < ' tcx > ,
452
452
alloc_id : AllocId ,
453
453
) -> ErrorHandled {
0 commit comments