Skip to content

Commit 8730410

Browse files
committed
make ValueVisitor mut-polymorphic
1 parent 7565b5a commit 8730410

File tree

3 files changed

+190
-219
lines changed

3 files changed

+190
-219
lines changed

src/librustc_mir/const_eval.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ fn validate_const<'a, 'tcx>(
535535
key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
536536
) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> {
537537
let cid = key.value;
538-
let mut ecx = mk_eval_cx(tcx, cid.instance, key.param_env).unwrap();
538+
let ecx = mk_eval_cx(tcx, cid.instance, key.param_env).unwrap();
539539
let val = (|| {
540540
let op = ecx.const_to_op(constant)?;
541541
let mut ref_tracking = RefTracking::new(op);

src/librustc_mir/interpret/validity.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ struct ValidityVisitor<'rt, 'a: 'rt, 'mir: 'rt, 'tcx: 'a+'rt+'mir, M: Machine<'a
129129
path: Vec<PathElem>,
130130
ref_tracking: Option<&'rt mut RefTracking<'tcx, M::PointerTag>>,
131131
const_mode: bool,
132-
ecx: &'rt mut EvalContext<'a, 'mir, 'tcx, M>,
132+
ecx: &'rt EvalContext<'a, 'mir, 'tcx, M>,
133133
}
134134

135135
impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> ValidityVisitor<'rt, 'a, 'mir, 'tcx, M> {
@@ -188,8 +188,8 @@ impl<'rt, 'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>
188188
type V = OpTy<'tcx, M::PointerTag>;
189189

190190
#[inline(always)]
191-
fn ecx(&mut self) -> &mut EvalContext<'a, 'mir, 'tcx, M> {
192-
&mut self.ecx
191+
fn ecx(&self) -> &EvalContext<'a, 'mir, 'tcx, M> {
192+
&self.ecx
193193
}
194194

195195
#[inline]
@@ -557,7 +557,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
557557
/// This also toggles between "run-time" (no recursion) and "compile-time" (with recursion)
558558
/// validation (e.g., pointer values are fine in integers at runtime).
559559
pub fn validate_operand(
560-
&mut self,
560+
&self,
561561
op: OpTy<'tcx, M::PointerTag>,
562562
path: Vec<PathElem>,
563563
ref_tracking: Option<&mut RefTracking<'tcx, M::PointerTag>>,

0 commit comments

Comments
 (0)