Skip to content

Commit

Permalink
make ValueVisitor mut-polymorphic
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 5, 2018
1 parent 7565b5a commit 8730410
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 219 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/const_eval.rs
Expand Up @@ -535,7 +535,7 @@ fn validate_const<'a, 'tcx>(
key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>,
) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> {
let cid = key.value;
let mut ecx = mk_eval_cx(tcx, cid.instance, key.param_env).unwrap();
let ecx = mk_eval_cx(tcx, cid.instance, key.param_env).unwrap();
let val = (|| {
let op = ecx.const_to_op(constant)?;
let mut ref_tracking = RefTracking::new(op);
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/interpret/validity.rs
Expand Up @@ -129,7 +129,7 @@ struct ValidityVisitor<'rt, 'a: 'rt, 'mir: 'rt, 'tcx: 'a+'rt+'mir, M: Machine<'a
path: Vec<PathElem>,
ref_tracking: Option<&'rt mut RefTracking<'tcx, M::PointerTag>>,
const_mode: bool,
ecx: &'rt mut EvalContext<'a, 'mir, 'tcx, M>,
ecx: &'rt EvalContext<'a, 'mir, 'tcx, M>,
}

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

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

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

0 comments on commit 8730410

Please sign in to comment.