Skip to content

Commit 018d128

Browse files
committed
rename evaluator -> interpreter to make eddyb happy
1 parent 169f791 commit 018d128

File tree

8 files changed

+21
-34
lines changed

8 files changed

+21
-34
lines changed

src/librustc_codegen_llvm/mir/constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use llvm;
1212
use rustc::mir::interpret::{ConstEvalErr, read_target_uint};
13-
use rustc_mir::interpret::{const_field};
13+
use rustc_mir::const_eval::const_field;
1414
use rustc::hir::def_id::DefId;
1515
use rustc::mir;
1616
use rustc_data_structures::indexed_vec::Idx;

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ fn validate_const<'a, 'tcx>(
16121612
gid: ::rustc::mir::interpret::GlobalId<'tcx>,
16131613
what: &str,
16141614
) {
1615-
let ecx = ::rustc_mir::interpret::mk_eval_cx(tcx, gid.instance, param_env).unwrap();
1615+
let ecx = ::rustc_mir::const_eval::mk_eval_cx(tcx, gid.instance, param_env).unwrap();
16161616
let result = (|| {
16171617
let op = ecx.const_to_op(constant)?;
16181618
let mut todo = vec![(op, Vec::new())];

src/librustc_mir/const_eval.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn mk_borrowck_eval_cx<'a, 'mir, 'tcx>(
4242
) -> EvalResult<'tcx, CompileTimeEvalContext<'a, 'mir, 'tcx>> {
4343
debug!("mk_borrowck_eval_cx: {:?}", instance);
4444
let param_env = tcx.param_env(instance.def_id());
45-
let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeEvaluator::new(), ());
45+
let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeInterpreter::new(), ());
4646
// insert a stack frame so any queries have the correct substs
4747
ecx.stack.push(interpret::Frame {
4848
block: mir::START_BLOCK,
@@ -64,7 +64,7 @@ pub fn mk_eval_cx<'a, 'tcx>(
6464
) -> EvalResult<'tcx, CompileTimeEvalContext<'a, 'tcx, 'tcx>> {
6565
debug!("mk_eval_cx: {:?}, {:?}", instance, param_env);
6666
let span = tcx.def_span(instance.def_id());
67-
let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeEvaluator::new(), ());
67+
let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeInterpreter::new(), ());
6868
let mir = ecx.load_mir(instance.def)?;
6969
// insert a stack frame so any queries have the correct substs
7070
ecx.push_stack_frame(
@@ -133,7 +133,7 @@ fn eval_body_and_ecx<'a, 'mir, 'tcx>(
133133
// and try improving it down the road when more information is available
134134
let span = tcx.def_span(cid.instance.def_id());
135135
let span = mir.map(|mir| mir.span).unwrap_or(span);
136-
let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeEvaluator::new(), ());
136+
let mut ecx = EvalContext::new(tcx.at(span), param_env, CompileTimeInterpreter::new(), ());
137137
let r = eval_body_using_ecx(&mut ecx, cid, mir, param_env);
138138
(r, ecx)
139139
}
@@ -230,7 +230,7 @@ impl Error for ConstEvalError {
230230
}
231231

232232
// Extra machine state for CTFE, and the Machine instance
233-
pub struct CompileTimeEvaluator<'a, 'mir, 'tcx: 'a+'mir> {
233+
pub struct CompileTimeInterpreter<'a, 'mir, 'tcx: 'a+'mir> {
234234
/// When this value is negative, it indicates the number of interpreter
235235
/// steps *until* the loop detector is enabled. When it is positive, it is
236236
/// the number of steps after the detector has been enabled modulo the loop
@@ -241,20 +241,20 @@ pub struct CompileTimeEvaluator<'a, 'mir, 'tcx: 'a+'mir> {
241241
pub(super) loop_detector: snapshot::InfiniteLoopDetector<'a, 'mir, 'tcx>,
242242
}
243243

244-
impl<'a, 'mir, 'tcx> CompileTimeEvaluator<'a, 'mir, 'tcx> {
244+
impl<'a, 'mir, 'tcx> CompileTimeInterpreter<'a, 'mir, 'tcx> {
245245
fn new() -> Self {
246-
CompileTimeEvaluator {
246+
CompileTimeInterpreter {
247247
loop_detector: Default::default(),
248248
steps_since_detector_enabled: -snapshot::STEPS_UNTIL_DETECTOR_ENABLED,
249249
}
250250
}
251251
}
252252

253253
type CompileTimeEvalContext<'a, 'mir, 'tcx> =
254-
EvalContext<'a, 'mir, 'tcx, CompileTimeEvaluator<'a, 'mir, 'tcx>>;
254+
EvalContext<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>;
255255

256256
impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx>
257-
for CompileTimeEvaluator<'a, 'mir, 'tcx>
257+
for CompileTimeInterpreter<'a, 'mir, 'tcx>
258258
{
259259
type MemoryData = ();
260260
type MemoryKinds = !;

src/librustc_mir/hair/pattern/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ mod check_match;
1616
pub use self::check_match::check_crate;
1717
pub(crate) use self::check_match::check_match;
1818

19-
use interpret::{const_field, const_variant_index};
19+
use const_eval::{const_field, const_variant_index};
2020

2121
use rustc::mir::{fmt_const_val, Field, BorrowKind, Mutability};
2222
use rustc::mir::interpret::{Scalar, GlobalId, ConstValue, sign_extend};

src/librustc_mir/interpret/mod.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,3 @@ pub use self::memory::{Memory, MemoryKind};
3535
pub use self::machine::Machine;
3636

3737
pub use self::operand::{Value, ValTy, Operand, OpTy};
38-
39-
// reexports for compatibility
40-
pub use const_eval::{
41-
eval_promoted,
42-
mk_borrowck_eval_cx,
43-
mk_eval_cx,
44-
CompileTimeEvaluator,
45-
const_to_allocation_provider,
46-
const_eval_provider,
47-
const_field,
48-
const_variant_index,
49-
op_to_const,
50-
};

src/librustc_mir/interpret/snapshot.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use syntax::source_map::Span;
2626

2727
use super::eval_context::{LocalValue, StackPopCleanup};
2828
use super::{Frame, Memory, Operand, MemPlace, Place, Value};
29-
use const_eval::CompileTimeEvaluator;
29+
use const_eval::CompileTimeInterpreter;
3030

3131
/// Number of steps until the detector even starts doing anything.
3232
/// Also, a warning is shown to the user when this number is reached.
@@ -61,7 +61,7 @@ impl<'a, 'mir, 'tcx> InfiniteLoopDetector<'a, 'mir, 'tcx>
6161
pub fn observe_and_analyze<'b>(
6262
&mut self,
6363
tcx: &TyCtxt<'b, 'tcx, 'tcx>,
64-
memory: &Memory<'a, 'mir, 'tcx, CompileTimeEvaluator<'a, 'mir, 'tcx>>,
64+
memory: &Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>,
6565
stack: &[Frame<'mir, 'tcx>],
6666
) -> EvalResult<'tcx, ()> {
6767

@@ -391,25 +391,25 @@ impl<'a, 'mir, 'tcx, Ctx> Snapshot<'a, Ctx> for &'a Frame<'mir, 'tcx>
391391
}
392392

393393
impl<'a, 'b, 'mir, 'tcx: 'a+'mir> SnapshotContext<'b>
394-
for Memory<'a, 'mir, 'tcx, CompileTimeEvaluator<'a, 'mir, 'tcx>>
394+
for Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>
395395
{
396396
fn resolve(&'b self, id: &AllocId) -> Option<&'b Allocation> {
397397
self.get(*id).ok()
398398
}
399399
}
400400

401401
/// The virtual machine state during const-evaluation at a given point in time.
402-
/// We assume the `CompileTimeEvaluator` has no interesting extra state that
402+
/// We assume the `CompileTimeInterpreter` has no interesting extra state that
403403
/// is worth considering here.
404404
struct EvalSnapshot<'a, 'mir, 'tcx: 'a + 'mir> {
405-
memory: Memory<'a, 'mir, 'tcx, CompileTimeEvaluator<'a, 'mir, 'tcx>>,
405+
memory: Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>,
406406
stack: Vec<Frame<'mir, 'tcx>>,
407407
}
408408

409409
impl<'a, 'mir, 'tcx: 'a + 'mir> EvalSnapshot<'a, 'mir, 'tcx>
410410
{
411411
fn new(
412-
memory: &Memory<'a, 'mir, 'tcx, CompileTimeEvaluator<'a, 'mir, 'tcx>>,
412+
memory: &Memory<'a, 'mir, 'tcx, CompileTimeInterpreter<'a, 'mir, 'tcx>>,
413413
stack: &[Frame<'mir, 'tcx>]
414414
) -> Self {
415415
EvalSnapshot {

src/librustc_mir/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ pub fn provide(providers: &mut Providers) {
9595
borrow_check::provide(providers);
9696
shim::provide(providers);
9797
transform::provide(providers);
98-
providers.const_eval = interpret::const_eval_provider;
98+
providers.const_eval = const_eval::const_eval_provider;
9999
providers.check_match = hair::pattern::check_match;
100100
}
101101

src/librustc_mir/transform/const_prop.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use rustc::mir::interpret::{
2121
ConstEvalErr, EvalErrorKind, ScalarMaybeUndef, Scalar, GlobalId, EvalResult
2222
};
2323
use rustc::ty::{TyCtxt, self, Instance};
24-
use interpret::{EvalContext, CompileTimeEvaluator, eval_promoted, mk_borrowck_eval_cx};
25-
use interpret::{self, Value, OpTy, MemoryKind};
24+
use interpret::{self, EvalContext, Value, OpTy, MemoryKind};
25+
use const_eval::{CompileTimeInterpreter, eval_promoted, mk_borrowck_eval_cx};
2626
use transform::{MirPass, MirSource};
2727
use syntax::source_map::{Span, DUMMY_SP};
2828
use rustc::ty::subst::Substs;
@@ -69,7 +69,7 @@ type Const<'tcx> = (OpTy<'tcx>, Span);
6969

7070
/// Finds optimization opportunities on the MIR.
7171
struct ConstPropagator<'b, 'a, 'tcx:'a+'b> {
72-
ecx: EvalContext<'a, 'b, 'tcx, CompileTimeEvaluator<'a, 'b, 'tcx>>,
72+
ecx: EvalContext<'a, 'b, 'tcx, CompileTimeInterpreter<'a, 'b, 'tcx>>,
7373
mir: &'b Mir<'tcx>,
7474
tcx: TyCtxt<'a, 'tcx, 'tcx>,
7575
source: MirSource,

0 commit comments

Comments
 (0)