Skip to content

Commit e475539

Browse files
committed
Add MemoryExtra in InterpretCx constructor params
1 parent 8ec3942 commit e475539

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

src/librustc_mir/const_eval.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub(crate) fn mk_eval_cx<'mir, 'tcx>(
4747
param_env: ty::ParamEnv<'tcx>,
4848
) -> CompileTimeEvalContext<'mir, 'tcx> {
4949
debug!("mk_eval_cx: {:?}", param_env);
50-
InterpretCx::new(tcx.at(span), param_env, CompileTimeInterpreter::new())
50+
InterpretCx::new(tcx.at(span), param_env, CompileTimeInterpreter::new(), Default::default())
5151
}
5252

5353
pub(crate) fn eval_promoted<'mir, 'tcx>(
@@ -632,7 +632,11 @@ pub fn const_eval_raw_provider<'tcx>(
632632
}
633633

634634
let span = tcx.def_span(cid.instance.def_id());
635-
let mut ecx = InterpretCx::new(tcx.at(span), key.param_env, CompileTimeInterpreter::new());
635+
let mut ecx = InterpretCx::new(
636+
tcx.at(span),
637+
key.param_env,
638+
CompileTimeInterpreter::new(),
639+
Default::default());
636640

637641
let res = ecx.load_mir(cid.instance.def);
638642
res.map(|body| {

src/librustc_mir/interpret/eval_context.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,17 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> LayoutOf for InterpretCx<'mir, 'tcx, M>
196196
}
197197

198198
impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpretCx<'mir, 'tcx, M> {
199-
pub fn new(tcx: TyCtxtAt<'tcx>, param_env: ty::ParamEnv<'tcx>, machine: M) -> Self {
199+
pub fn new(
200+
tcx: TyCtxtAt<'tcx>,
201+
param_env: ty::ParamEnv<'tcx>,
202+
machine: M,
203+
memory_extra: M::MemoryExtra,
204+
) -> Self {
200205
InterpretCx {
201206
machine,
202207
tcx,
203208
param_env,
204-
memory: Memory::new(tcx),
209+
memory: Memory::new(tcx, memory_extra),
205210
stack: Vec::new(),
206211
vtables: FxHashMap::default(),
207212
}

src/librustc_mir/interpret/memory.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ where
106106
}
107107

108108
impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
109-
pub fn new(tcx: TyCtxtAt<'tcx>) -> Self {
109+
pub fn new(tcx: TyCtxtAt<'tcx>, extra: M::MemoryExtra) -> Self {
110110
Memory {
111111
alloc_map: M::MemoryMap::default(),
112112
dead_alloc_map: FxHashMap::default(),
113-
extra: M::MemoryExtra::default(),
113+
extra,
114114
tcx,
115115
}
116116
}

0 commit comments

Comments
 (0)