@@ -22,7 +22,7 @@ use syntax::source_map::{Span, DUMMY_SP};
22
22
use crate :: interpret:: { self ,
23
23
PlaceTy , MPlaceTy , MemPlace , OpTy , ImmTy , Immediate , Scalar , Pointer ,
24
24
RawConst , ConstValue ,
25
- EvalResult , EvalError , EvalErrorKind , GlobalId , EvalContext , StackPopCleanup ,
25
+ EvalResult , EvalError , EvalErrorKind , GlobalId , InterpretCx , StackPopCleanup ,
26
26
Allocation , AllocId , MemoryKind ,
27
27
snapshot, RefTracking ,
28
28
} ;
@@ -34,7 +34,7 @@ const STEPS_UNTIL_DETECTOR_ENABLED: isize = 1_000_000;
34
34
/// Should be a power of two for performance reasons.
35
35
const DETECTOR_SNAPSHOT_PERIOD : isize = 256 ;
36
36
37
- /// The `EvalContext ` is only meant to be used to do field and index projections into constants for
37
+ /// The `InterpretCx ` is only meant to be used to do field and index projections into constants for
38
38
/// `simd_shuffle` and const patterns in match arms.
39
39
///
40
40
/// The function containing the `match` that is currently being analyzed may have generic bounds
@@ -47,7 +47,7 @@ pub(crate) fn mk_eval_cx<'a, 'mir, 'tcx>(
47
47
param_env : ty:: ParamEnv < ' tcx > ,
48
48
) -> CompileTimeEvalContext < ' a , ' mir , ' tcx > {
49
49
debug ! ( "mk_eval_cx: {:?}" , param_env) ;
50
- EvalContext :: new ( tcx. at ( span) , param_env, CompileTimeInterpreter :: new ( ) )
50
+ InterpretCx :: new ( tcx. at ( span) , param_env, CompileTimeInterpreter :: new ( ) )
51
51
}
52
52
53
53
pub ( crate ) fn eval_promoted < ' a , ' mir , ' tcx > (
@@ -116,7 +116,7 @@ fn eval_body_and_ecx<'a, 'mir, 'tcx>(
116
116
// and try improving it down the road when more information is available
117
117
let span = tcx. def_span ( cid. instance . def_id ( ) ) ;
118
118
let span = mir. map ( |mir| mir. span ) . unwrap_or ( span) ;
119
- let mut ecx = EvalContext :: new ( tcx. at ( span) , param_env, CompileTimeInterpreter :: new ( ) ) ;
119
+ let mut ecx = InterpretCx :: new ( tcx. at ( span) , param_env, CompileTimeInterpreter :: new ( ) ) ;
120
120
let r = eval_body_using_ecx ( & mut ecx, cid, mir, param_env) ;
121
121
( r, ecx)
122
122
}
@@ -292,7 +292,7 @@ impl<K: Hash + Eq, V> interpret::AllocMap<K, V> for FxHashMap<K, V> {
292
292
}
293
293
294
294
type CompileTimeEvalContext < ' a , ' mir , ' tcx > =
295
- EvalContext < ' a , ' mir , ' tcx , CompileTimeInterpreter < ' a , ' mir , ' tcx > > ;
295
+ InterpretCx < ' a , ' mir , ' tcx , CompileTimeInterpreter < ' a , ' mir , ' tcx > > ;
296
296
297
297
impl interpret:: MayLeak for ! {
298
298
#[ inline( always) ]
@@ -317,12 +317,12 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx>
317
317
const STATIC_KIND : Option < !> = None ; // no copying of statics allowed
318
318
319
319
#[ inline( always) ]
320
- fn enforce_validity ( _ecx : & EvalContext < ' a , ' mir , ' tcx , Self > ) -> bool {
320
+ fn enforce_validity ( _ecx : & InterpretCx < ' a , ' mir , ' tcx , Self > ) -> bool {
321
321
false // for now, we don't enforce validity
322
322
}
323
323
324
324
fn find_fn (
325
- ecx : & mut EvalContext < ' a , ' mir , ' tcx , Self > ,
325
+ ecx : & mut InterpretCx < ' a , ' mir , ' tcx , Self > ,
326
326
instance : ty:: Instance < ' tcx > ,
327
327
args : & [ OpTy < ' tcx > ] ,
328
328
dest : Option < PlaceTy < ' tcx > > ,
@@ -362,7 +362,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx>
362
362
}
363
363
364
364
fn call_intrinsic (
365
- ecx : & mut EvalContext < ' a , ' mir , ' tcx , Self > ,
365
+ ecx : & mut InterpretCx < ' a , ' mir , ' tcx , Self > ,
366
366
instance : ty:: Instance < ' tcx > ,
367
367
args : & [ OpTy < ' tcx > ] ,
368
368
dest : PlaceTy < ' tcx > ,
@@ -378,7 +378,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx>
378
378
}
379
379
380
380
fn ptr_op (
381
- _ecx : & EvalContext < ' a , ' mir , ' tcx , Self > ,
381
+ _ecx : & InterpretCx < ' a , ' mir , ' tcx , Self > ,
382
382
_bin_op : mir:: BinOp ,
383
383
_left : ImmTy < ' tcx > ,
384
384
_right : ImmTy < ' tcx > ,
@@ -406,15 +406,15 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx>
406
406
}
407
407
408
408
fn box_alloc (
409
- _ecx : & mut EvalContext < ' a , ' mir , ' tcx , Self > ,
409
+ _ecx : & mut InterpretCx < ' a , ' mir , ' tcx , Self > ,
410
410
_dest : PlaceTy < ' tcx > ,
411
411
) -> EvalResult < ' tcx > {
412
412
Err (
413
413
ConstEvalError :: NeedsRfc ( "heap allocations via `box` keyword" . to_string ( ) ) . into ( ) ,
414
414
)
415
415
}
416
416
417
- fn before_terminator ( ecx : & mut EvalContext < ' a , ' mir , ' tcx , Self > ) -> EvalResult < ' tcx > {
417
+ fn before_terminator ( ecx : & mut InterpretCx < ' a , ' mir , ' tcx , Self > ) -> EvalResult < ' tcx > {
418
418
{
419
419
let steps = & mut ecx. machine . steps_since_detector_enabled ;
420
420
@@ -440,7 +440,7 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx>
440
440
441
441
#[ inline( always) ]
442
442
fn tag_new_allocation (
443
- _ecx : & mut EvalContext < ' a , ' mir , ' tcx , Self > ,
443
+ _ecx : & mut InterpretCx < ' a , ' mir , ' tcx , Self > ,
444
444
ptr : Pointer ,
445
445
_kind : MemoryKind < Self :: MemoryKinds > ,
446
446
) -> Pointer {
@@ -449,15 +449,15 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx>
449
449
450
450
#[ inline( always) ]
451
451
fn stack_push (
452
- _ecx : & mut EvalContext < ' a , ' mir , ' tcx , Self > ,
452
+ _ecx : & mut InterpretCx < ' a , ' mir , ' tcx , Self > ,
453
453
) -> EvalResult < ' tcx > {
454
454
Ok ( ( ) )
455
455
}
456
456
457
457
/// Called immediately before a stack frame gets popped.
458
458
#[ inline( always) ]
459
459
fn stack_pop (
460
- _ecx : & mut EvalContext < ' a , ' mir , ' tcx , Self > ,
460
+ _ecx : & mut InterpretCx < ' a , ' mir , ' tcx , Self > ,
461
461
_extra : ( ) ,
462
462
) -> EvalResult < ' tcx > {
463
463
Ok ( ( ) )
@@ -504,7 +504,7 @@ pub fn const_variant_index<'a, 'tcx>(
504
504
}
505
505
506
506
pub fn error_to_const_error < ' a , ' mir , ' tcx > (
507
- ecx : & EvalContext < ' a , ' mir , ' tcx , CompileTimeInterpreter < ' a , ' mir , ' tcx > > ,
507
+ ecx : & InterpretCx < ' a , ' mir , ' tcx , CompileTimeInterpreter < ' a , ' mir , ' tcx > > ,
508
508
mut error : EvalError < ' tcx >
509
509
) -> ConstEvalErr < ' tcx > {
510
510
error. print_backtrace ( ) ;
0 commit comments