Skip to content

Commit

Permalink
Rollup merge of rust-lang#61104 - spastorino:eval-place-to-op-iterate…
Browse files Browse the repository at this point in the history
…, r=oli-obk

Make eval_place_to_op iterate instead of recurse

r? @oli-obk
  • Loading branch information
Centril committed May 24, 2019
2 parents 4db872d + 3dccf83 commit 76e7a57
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/librustc_mir/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,22 +467,22 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> InterpretCx<'a, 'mir, 'tcx, M>
mir_place: &mir::Place<'tcx>,
layout: Option<TyLayout<'tcx>>,
) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>> {
use rustc::mir::Place::*;
use rustc::mir::PlaceBase;
let op = match *mir_place {
Base(PlaceBase::Local(mir::RETURN_PLACE)) => return err!(ReadFromReturnPointer),
Base(PlaceBase::Local(local)) => self.access_local(self.frame(), local, layout)?,

Projection(ref proj) => {
let op = self.eval_place_to_op(&proj.base, None)?;
self.operand_projection(op, &proj.elem)?
}
mir_place.iterate(|place_base, place_projection| {
let mut op = match place_base {
PlaceBase::Local(mir::RETURN_PLACE) => return err!(ReadFromReturnPointer),
PlaceBase::Local(local) => self.access_local(self.frame(), *local, layout)?,
_ => self.eval_place_to_mplace(mir_place)?.into(),
};

_ => self.eval_place_to_mplace(mir_place)?.into(),
};
for proj in place_projection {
op = self.operand_projection(op, &proj.elem)?
}

trace!("eval_place_to_op: got {:?}", *op);
Ok(op)
trace!("eval_place_to_op: got {:?}", op);
Ok(op)
})
}

/// Evaluate the operand, returning a place where you can then find the data.
Expand Down

0 comments on commit 76e7a57

Please sign in to comment.